Hii, I am deploying openfaas to digital ocean usin...
# general
n
Hii, I am deploying openfaas to digital ocean using helm chart and it is giving me error
resource openfaas/alertmanager was not successfully created by the Kubernetes API server : namespaces "openfaas" not found
What is wrong in this code. Here is the code I am using :
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
import * as k8s from "@pulumi/kubernetes";

// Create a new DO Kubernetes cluster
const doK8sCluster = new digitalocean.KubernetesCluster("do-cluster", {
    region: digitalocean.Region.NYC1,
    version: "1.28.2-do.0",
    nodePool: {
        name: "worker-pool",
        size: "s-1vcpu-2gb",
        nodeCount: 3,
    },
});

// Export the Kubeconfig
export const kubeconfig = doK8sCluster.kubeConfigs[0].rawConfig;

// Create a Kubernetes provider instance that uses our cluster from above.
const k8sProvider = new k8s.Provider("k8sProvider", {
    kubeconfig: kubeconfig,
});

// If needed, deploy the NGINX ingress controller
const nginxIngress = new k8s.helm.v3.Chart("nginx-ingress", {
    chart: "ingress-nginx",
    // version: "1.0.0",
    fetchOpts: {
        repo: "<https://kubernetes.github.io/ingress-nginx>",
    },
    namespace: "default",
}, { provider: k8sProvider });

// Deploy your K8s pod set
const appName = "nginx";
const appLabels = { app: appName };
const deployment = new k8s.apps.v1.Deployment("nginx-deployment", {
    spec: {
        selector: { matchLabels: appLabels },
        replicas: 1,
        template: {
            metadata: { labels: appLabels },
            spec: { containers: [{ name: appName, image: "nginx" }] }
        }
    },
}, { provider: k8sProvider });

// Expose your deployment using a service
new k8s.core.v1.Service("nginx-service", {
    metadata: { labels: appLabels },
    spec: {
        type: "LoadBalancer",
        ports: [{ port: 80 }],
        selector: appLabels,
    },
}, { provider: k8sProvider });

const openfaasNamespace = new k8s.core.v1.Namespace("openfaas", {}, { provider: k8sProvider });

openfaasNamespace.id.apply((id) => {
const openFaasChart = new k8s.helm.v3.Chart("openfaas", {
    fetchOpts: { repo: "<https://openfaas.github.io/faas-netes/>" },
    chart: "openfaas",
    namespace: "openfaas",
}, { provider: k8sProvider,
    dependsOn: openfaasNamespace
 });
})
d
Pulumi will default to appending a random string onto resource names unless you specify them explicitly. For the namespace, specify
{metadata: {name: "openfaas"}}
as the args
n
@dry-keyboard-94795 I applied the changes and its working fine now. Thanks a lot for helping me. But its giving me this error also, how can I solve this:
Copy code
error: 3 errors occurred:
        * the Kubernetes API server reported that "default/nginx-ingress-ingress-nginx-controller" failed to fully initialize or become live: 'nginx-ingress-ingress-nginx-controller' timed out waiting to be Ready
        * Minimum number of live Pods was not attained
        * [Pod nginx-ingress-ingress-nginx-controller-6559469f-zdvdc]: containers with unready status: [controller]
d
Could be that the timeout needs extending to give DO more time to provision the load balancer
If you rerun the update now some time has passed, does it work?