Hi, is it possible to to provision k8s EKS cluster...
# python
b
Hi, is it possible to to provision k8s EKS cluster and deploy some config in a single pulumi run? It seems it is possible in typescript according to the following example, I am wondering if it is possible to achieve it in python
this is how it can be done in TypeScript ^
b
Yes, of course, you can do it with Python SDK. For example,
Copy code
traefik_internal_ip = traefik_chart.get_resource(
    'v1/Service',
    'traefik',
    namespace=traefik_namespace_name,
)
and then manipulate it as you want
Copy code
rrdatas=[
        traefik_internal_ip.apply(
            lambda x: x.status['load_balancer']['ingress'][0]['ip']
        ),
    ],
b
I am not sure I understand. I think the problem I have is specifically related to kubernetes and EKS. Pulumi needs to know where to connect to (to which Kubernetes cluster) when you want to use resources from the pulumi_kubernetes.core.v1 package (like for example the Service class). Normally pulumi takes this from the system wide kubeconfig file but if the Kubernetes cluster itself is being provisioned during the pulumi up I need to somehow retrieve configuration details of newly provisioned kubernetes cluster and make pulumi to use them when provisioning further kubernetes objects
and I don't see how python implementation of EKS exposes this kubeconfig stuff. For example the microsoft version - the aks container service exposes it via "kube_config_raw"
and the above example I posted in the screenshot does it too in the TypeScript
but in python there seems to be no such possibility for eks
b
the EKS module is available in python @boundless-angle-56560 - it should have the same outputs in all languages
did you give it a try, or do you need an example?
b
@billowy-army-68599 I use this:
from pulumi_aws import eks
eks_cluster = eks.Cluster( 'prm-eks-cluster', role_arn=eks_iam.eks_role.arn, tags={ 'Name': 'pulumi-eks-cluster', }, vpc_config=eks.ClusterVpcConfigArgs( public_access_cidrs=['0.0.0.0/0'], security_group_ids=[eks_vpc.eks_security_group.id], subnet_ids=eks_vpc.subnet_ids, ), )
but that object doesn't have a property that would give me a provider like in the typescript example from my screenshot
b
looking now
b
from what I understood the typescript example leverages crossplane while my example uses raw aws module
as crossplane is not available in python
b
this appears to work for me
Copy code
"""An AWS Python Pulumi program"""

import pulumi
import pulumi_eks as eks

cluster = eks.Cluster("python")

pulumi.export("kubeconfig", cluster.kubeconfig)
b
hmmmm
I'll try
b
wait, sorry I see now
you need to use our EKS provider: https://github.com/pulumi/pulumi-eks
you're importing the plain EKS resource from the AWS provider, we have a much more fully featured option above ^^
if you want to do this manually, you can construct your kubeconfig manually https://github.com/pulumi/examples/tree/master/aws-py-eks but I'd recommend using the EKS provider
b
aham that makes sense, for some reason I didn't know that it is available
probably all examples cointained the raw module :))
oh my do I love pulumi, its actually working
I did the raw version with the util thing but I suppose the high level module will work too
b
you have a lot of flexibility, it's best to do what you need!