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

brainy-accountant-88780

03/14/2024, 1:01 PM
Hi together, what does I have to do if I have 3 self hosted k8s clusters and I should configure everything with one "pulumi up" command. Is that in general possible?
b

billions-xylophone-85957

03/14/2024, 1:10 PM
yes, you need to explicitly configure the different k8s providers for each cluster and pass those providers to relevant resources
b

brainy-accountant-88780

03/14/2024, 2:18 PM
Is there an example / tutorial available?
b

billions-xylophone-85957

03/14/2024, 2:34 PM
almost every pulumi resource has args and options. Options generally contain some pulumi stuff (like
parent
and
dependsOn
etc etc) and may contain platform-specific things (like region for e.g. aws provider or in this case kube cluster config) You can create a provider from kubeconfig like
Copy code
const clusterAProvider = new k8s.Provider("foo", {
            kubeconfig: clusterAKubeConfig,
        }, )
and then give it to your resource like
Copy code
const service = new k8s.core.v1.Service(`foo-svc`, {
            spec: { <svc spec> },
        }, {provider: clusterAProvider})
there even may be some syntax sugar to help you, e.g.
eks.Cluster
object already has the
provider
property
https://github.com/pulumi/pulumi-kubernetes this README is somewhat helpful