```import * as k8s from "@pulumi/kubernetes"; co...
# general
h
Copy code
import * as k8s from "@pulumi/kubernetes";


const renderProvider = new k8s.Provider("k8s-yaml-renderer", {
    renderYamlToDirectory: "../../services/staging/",
});

const appLabels = { app: "nginx" };

function serviceMetadata(svcName: string) {
    return {
        name: svcName,
    };
}
const deployment = new k8s.apps.v1.Deployment("nginx", {
    metadata: serviceMetadata("nginx"),
    spec: {
        selector: { matchLabels: appLabels },
        replicas: 1,
        template: {
            metadata: { labels: appLabels },
            spec: { containers: [{ name: "nginx", image: "nginx" }] }
        }
    }
}, { provider: renderProvider });
b
do
pulumi up -r
h
getting this error now: https://app.warp.dev/block/QsvuO0j2pSyYJNZEXOqUuj our goal is to only generate yaml btw
we dont want it talking to actual k8s cluster at all really
b
well this is going to create a deployment on your cluster, you’ll need to remove it
Copy code
const deployment = new k8s.apps.v1.Deployment("nginx", {
    metadata: serviceMetadata("nginx"),
    spec: {
        selector: { matchLabels: appLabels },
        replicas: 1,
        template: {
            metadata: { labels: appLabels },
            spec: { containers: [{ name: "nginx", image: "nginx" }] }
        }
    }
}, { provider: renderProvider });
h
but if i remove that code block, how will i generate the yaml for it?
b
ah sorry yes, I missed that you’re setting that render provider there. you might have to disable the default provider https://www.pulumi.com/blog/disable-default-providers/
h
so i added this to
Pulumi.yaml
. still no success
its still trying to get aws credentials
b
did you originally run with a local kubeconfig that pointed to that cluster? if so, it has that provider stored in sttae
state*
you’ll likely need to destroy and refresh to remove the provider from your state
h
ok. what is the command for that
also do i need to destroy 'stack' or 'state'?
b
if you destroy the stack, it’ll leave you with a clean state where the provider isn’t present
pulumi destroy
if the clyster isn’t reachable you may need to do
Copy code
PULUMI_K8S_DELETE_UNREACHABLE=true p destroy -r --yes
h
what does this do:
PULUMI_K8S_DELETE_UNREACHABLE=true
h
https://app.warp.dev/block/XlLyBPdYE7XJmfZBXqb8EZ did this. but now do i need to fully delete the stack too?
if i dont, i get back to the original issue after running
pulumi up
once
b
you shouldn’t, no. I suspect this might be a bug in the render option, feel free to open an issue