https://pulumi.com logo
#general
Title
# general
d

damp-jelly-5493

12/16/2019, 8:12 AM
morning all. ive got a k8s cluster being provisioned and it all works very nicely - i'm using pulumi in typescript and using the digitalocean provider. the only problem ive got is with regards to refreshing the kubeconfig. when i first build the cluster, it generates a kubeconfig which i then set to a k8s provider so i can use it internally. the problem is that the kubeconfig that DO creates expires after 7 days. and because pulumi doesnt know this, it never calls DO to regenerate the token. this is what im doing so far:
Copy code
const k8s = new digitalocean.KubernetesCluster('Configure k8s', stackConfig.k8s);

const k8sConfig = k8s.kubeConfigs[0].rawConfig;

const k8sProvider = new kubernetes.Provider('Get k8s provider', {
  kubeconfig: k8sConfig,
});
the
k8sProvider
then is set to
provider
options any time i make an additional k8s call, eg
Copy code
const helmServiceAccount = new kubernetes.core.v1.ServiceAccount(
  'Helm RBAC service account',
  {
    apiVersion: 'v1',
    kind: 'ServiceAccount',
    metadata: {
      name: 'tiller',
      namespace: 'kube-system',
    },
  },
  {
    provider: k8sProvider,
  },
);
as i said, this all works fine for the first 7 days then breaks because the kubeconfig has expired within digitalocean