e

    echoing-postman-88590

    5 months ago
    Hi, I have defined the
    kubernetes.Provider
    to use the default path
    ~/.kube/config
    :
    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:
    secrets = kubernetes.core.v1.Secret(
        "secrets",
        metadata={
            "name": "secrets",
        },
        string_data={
            "key": "value",
            "KUBECONFIG": k8s_provider.kubeconfig,
        },
        opts=ResourceOptions(provider=k8s_provider),
    )
    b

    billowy-army-68599

    5 months ago
    @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

    echoing-postman-88590

    5 months ago
    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

    billowy-army-68599

    5 months ago
    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

    echoing-postman-88590

    5 months ago
    I need the kubeconfig content for another application, nothing to do with Pulumi.
    b

    billowy-army-68599

    5 months ago
    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

    echoing-postman-88590

    5 months ago
    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.