hi folks, I want to use a single pulumi stack to b...
# kubernetes
p
hi folks, I want to use a single pulumi stack to build an eks cluster and create a namespace in it. In pulumi/python, is there a way (in the same stack) upon building an eks cluster with pulumi, to then have that new cluster config used by all subsequent pulumi_kubernetes operations ? ie without needing to
aws eks --region us-east-1 update-kubeconfig
and
pulumi config set kubernetes:context
outside of the stack
it seems like maybe you can create a provider plumbed to a kubeconfig, but how do i ref that kubeconfig from the cluster ?
Copy code
kubeconfig = eks_cluster.kubeconfig
    AttributeError: 'Cluster' object has no attribute 'kubeconfig'
nm i just found this
<https://github.com/pulumi/examples/blob/master/aws-py-eks/utils.py>
and that looks like how to generate kubeconfig from eks cluster object…. i just assumed it would be built in to the cluster class
g
Assuming you’re using our EKS package, you can directly use the
provider
attribute: https://www.pulumi.com/docs/reference/pkg/eks/cluster/#provider_python
p
i am/was not… i was using the pulumi_aws stuff
but using that util to manually create the kubeconfig and then passing it to the provider got unexpected result
Copy code
Diagnostics:
  kubernetes:core/v1:Namespace (mynamespace):
    error: connection error: desc = "transport: Error while dialing dial tcp 127.0.0.1:50814: connect: connection refused"

  pulumi:pulumi:Stack (aws_eks-itplat-aws-eks):
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x291f5c2]
    goroutine 40 [running]:
    <http://github.com/pulumi/pulumi-kubernetes/provider/v3/pkg/provider.getActiveClusterFromConfig(0xc00010c600|github.com/pulumi/pulumi-kubernetes/provider/v3/pkg/provider.getActiveClusterFromConfig(0xc00010c600>, 0xc00032f680, 0xc0000add80)
is it recommended to use pulumi_eks rather than pulumi_aws.eks for eks resources? i’m getting mixed messages on this
g
I think
pulumi_eks
is a good starting point because it handles a lot of the relevant IAM and networking bits as well. You can set all of that up using the aws provider directly as well, but it takes more work up front.
p
yeah so i already have all the bits to build the cluster in place so im reluctant to switch it