Hi, I have defined the `kubernetes.Provider` to us...
# general
e
Hi, I have defined the
kubernetes.Provider
to use the default path
~/.kube/config
:
Copy code
k8s_provider = kubernetes.Provider("k8s")
But if I try to access the
k8s_provider.kubeconfig
argument it is empty. For example if I try to reference it in a secret:
Copy code
secrets = kubernetes.core.v1.Secret(
    "secrets",
    metadata={
        "name": "secrets",
    },
    string_data={
        "key": "value",
        "KUBECONFIG": k8s_provider.kubeconfig,
    },
    opts=ResourceOptions(provider=k8s_provider),
)
b
@echoing-postman-88590 this doesn't look correct, you're passing the provider as data into the secret? What are you trying to do?
e
I am not passing any data to the kubernetes Provider, I am relying on the default "read from ~/.kube/config". I would like to copy the kubeconfig content into a secret
b
you haven't actually read the file, all you've done is instantiated an empty provider. You need to use: https://www.pulumi.com/registry/packages/kubernetes/api-docs/provider/#kubeconfig_nodejs and read the filesystem file. The ambient provider doesn't read anything from disk
I'm sorta wondering why you want to put the kubeconfig in a secret though, you shouldn't really ever need to do that
e
I need the kubeconfig content for another application, nothing to do with Pulumi.
b
got it. it still shouldn't be needed, because anything running in cluster can just use service account authentication. but ultimately, you'll need to read the file from disk.
e
Yes, fair comment about the service account, in this case it is just easier to provide the kubeconfig for the application I am using. Anyway thanks for the suggestion.