Problem
Sometimes you need to change a kubeconfig file for an attached cluster in Kommander. For example, if the certificate in the kubeconfig is expired, you may observe the following error messages in the logs of kube-apiserver in the attached cluster:
E062213:08:28.4335201authentication.go:53]Unable to authenticate the request due to an error:[x509:certificate has expired or is not yet valid:currenttime2022-06-22T13:08:28Zisafter2022-06-21T14:55:39Z,verifyingcertificateSN=3739516375556171690,SKID=,AKID=5F:2A:3F:6F:EF:04:78:8B:68:A1:CF:4E:DF:18:C6:EB:D2:33:92:6Bfailed: x509: certificate has expired or is not yet valid:currenttime2022-06-22T13:08:28Zisafter2022-06-21T14:55:39Z]
Solution
Information about an attached cluster resides in an eponymous object of the KommanderCluster
kind (kommander.mesosphere.io/v1beta1
API). This object references a secret whose name starts with kubeconfig-
. This secret contains base64-encoded kubeconfig. Replace the old secret data with the new kubeconfig to resolve the problem.