https://pulumi.com logo
Title
j

jolly-stone-87333

03/27/2021, 3:55 PM
Hi Everyone I hope you're doing well. I've only just started using Pulumi for the first time, looking to use it to help deploy a third party solution 14 websites, db, redis, solr among other things. I've setup a C# app to generate a ManagedCluster with windows and linux pools. No issues there, but I'm trying to understand how I can tell Kubernetes.Core.V1.Service / Kubernetes.Apps.V1.Deployment or ConfigGroup to use the ManagedCluster I've created. Trying to use those, the system tells me error: configured Kubernetes cluster is unreachable: unable to load Kubernetes client configuration from kubeconfig file: invalid configuration: no configuration has been provided, try setting KUBERNETES_MASTER environment variable I guess I need to pass the cluster into those things or expose the kubeconfig in some way? If anyone can give some advice or point me in the direction of some documentation it would be a big help.
b

better-shampoo-48884

03/27/2021, 4:32 PM
There are a few options. If it's an AKS cluster, you can pull out credentials with: https://www.pulumi.com/docs/reference/pkg/azure-native/containerservice/listmanagedclusteradmincredentials/
I'm also presuming you're using the kubernetes provider for the kubernetes stuff? If so, you should configure the provider specifically to go towards the cluster you just got the credentials for:
const kubeConf = new azure-native.containerservice.listManagedClusterAdminCredentials({
  resourceGroupName: "yourRG",
  resourceName: "name-of-cluster"
});
const cluster = new k8s.Provider("clusterProvider", {
  kubeconfig: kubeConf.kubeconfigs
})
then when you do your k8s stuff later, you just add "cluster" as your provider
const mysvc = k8s.core.v1.Service("myService",{
  name: "My-Service"
},{
  cluster
})
t

tall-librarian-49374

03/27/2021, 9:56 PM
This C# example shows how to do that with Helm. You can use same approach to deploy k8s resources. https://github.com/pulumi/examples/tree/master/azure-cs-aks-helm
j

jolly-stone-87333

04/02/2021, 9:43 AM
Thanks @tall-librarian-49374 and @better-shampoo-48884 really appreciate the advice super helpful. Cheers for you taking the time to help the newbie 🙂 🍻
t

tall-librarian-49374

04/02/2021, 9:53 AM
Happy to help! Enjoy!