https://pulumi.com logo
#kubernetes
Title
# kubernetes
s

steep-toddler-88913

10/16/2021, 1:54 PM
Hi! I am just starting to use Pulumi. I am using Python, DigitalOcean, and now trying to add some Kubernetes pieces (specifically, I want to add some Secrets to my cluster). Is it possible to create a cluster, then in the same run/file hook into that cluster and create some secrets? I don't already have the kubeconfig, so I'm unclear on if I can use the pulumi_kubernetes package to do this. I speculate that the Provider might help since it takes a kubeconfig argument, but I don't know how to use the provider or if that'd even work. Also my apologies if this isn't the right spot for this question, happy to be redirected.
Copy code
import pulumi_digitalocean as do

k8s = do.KubernetesCluster("main-k8s",
                           region="nyc3",
                           version="1.21.3-do.0",
                           node_pool=do.KubernetesClusterNodePoolArgs(
                               name="main-pool",
                               size="s-1vcpu-2gb",
                               node_count=2
                           ))

# now create a secret in this^ cluster
s

steep-toddler-94095

10/16/2021, 4:33 PM
Yes this is entirely possible. Just set the Secret's provider in its opts parameter to your k8s cluster's provider value. You can create the provider using the kubeconfig value like you mentioned in your link https://www.pulumi.com/docs/reference/pkg/kubernetes/core/v1/secret/
s

steep-toddler-88913

10/16/2021, 4:41 PM
ahhh I did not thoroughly investigate the options there, wow thank you so much!!
p 1
4 Views