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.
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.