```"use strict"; const k8s = require("@pulumi/kube...
# general
c
Copy code
"use strict";
const k8s = require("@pulumi/kubernetes");

const appLabels = { app: "nginx" };
const deployment = new k8s.apps.v1.Deployment("nginx", {
    spec: {
        selector: { matchLabels: appLabels },
        replicas: 1,
        template: {
            metadata: { labels: appLabels },
            spec: { containers: [{ name: "nginx", image: "nginx:alpine" }] }
        }
    }
});
exports.name = deployment.metadata.name;
c
you need to specify the namespace in your deployment
Copy code
const deployment = new k8s.apps.v1.Deployment("nginx", {
    metadata: {
      namespace: "pulumi-starter"
    },
    spec: {
        selector: { matchLabels: appLabels },
        replicas: 1,
        template: {
            metadata: { labels: appLabels },
            spec: { containers: [{ name: "nginx", image: "nginx:alpine" }] }
        }
    }
});
or if you created the namespace with pulumi you could use
namespaceVariableName.metadata.name
instead of a hardcoded string
c
Ah, I had tried adding the ns earlier in the code but it didn’t somehow work. It seems to have triggered now. Apologies for the lame question 🤦‍♂️
🙂 1