does pulumi offer any functions to generate kubeco...
# kubernetes
c
does pulumi offer any functions to generate kubeconfig's ? I have an existing kubernetes cluster, and I want to try and connect to it using pulumi + typescript, the provider can accept a kubeconfig (https://www.pulumi.com/docs/reference/pkg/kubernetes/provider/) which is easy if i'd created the cluster using 
pulumi-eks
 . what am I missing?
b
Kindof and not really.. if the kubeconfig is on your machine, you can use that 🙂 Likely you'll be doing some CI/CD stuff though - in which case you would need to grab it from the resource, and to do that - your EKS cluster doesn't need to be fully managed by pulumi, but you can run this: https://www.pulumi.com/docs/reference/pkg/aws/eks/getclusterauth/ and hopefully that can lead you in the direction of a kubeconfig.. unfortunately i'm stuck more on the azure side of things where it spits out admin kubeconfigs left right and center, so the equivalent there is a bit easier.
c
cheers for that - what's the use case for getClusterAuth? what can you provide that token to, to do other stuff?
I ended up doing something like:
Copy code
const cluster = aws.eks.getCluster({name: "mycluster"})

export const kubeConfig = cluster.then(c => JSON.stringify({
    apiVersion: "v1",
    clusters: [
        {
            cluster: {
                "certificate-authority-data": c.certificateAuthority.data,
                server: c.endpoint,
            },
            name: "kubernetes",
        }
    ],
    contexts: [
        {
            context: {
                cluster: "kubernetes",
                user: "aws",
            },
            name: "aws",
        },
    ],
    "current-context": "aws",
    kind: "Config",
    users: [
        {
            name: "aws",
            user: {
                exec: {
                    apiVersion: "<http://client.authentication.k8s.io/v1alpha1|client.authentication.k8s.io/v1alpha1>",
                    args: [
                        "--region",
                        "us-west-2",
                        "eks",
                        "get-token",
                        "--cluster-name",
                        c.name,
                    ],
                    command: "aws",
                }
            }
        },
    ],
}));


const kubeClient = new k8s.Provider("mycluster", { kubeconfig: kubeConfig })