microk8s: root cert expired after a month, cluster does not respond anymore
running microk8s inspect does not work as well as talking to the cluster. error is this: x509: certificate has expired or is not yet valid
How can i renew the root cert?
How can i make it last longer than a month?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 5
- Comments: 21 (2 by maintainers)
The script I have for now is here: https://gist.github.com/ktsakalozos/5de8d4c86c976eeef0242cc39fdf82b2
It would be great if anyone would run it and provide feedback.
After running the script the pods in the cluster should go into an unknown state and restart after some seconds.
The intention is to place the above script in a
microk8s.refresh-certscommand to address this issue in affected deployments.@balchua the kubeconfig files use tokens but they also carry the ca.cert that is why I think they need to be recreated.
I hit upon the same issue just now, had to run
refresh.shand also had to give the coredns pod a kick, thank you @PeterSR for sharing that.Everything seems to be back to working order, however I cannot pull an image from a private repo now.
The image is definitely there, I can pull it with docker from another host using the same dockerconfig.json, I haven’t made any other changes to my cluster so that has me thinking that it’s related to refreshing the expired certs.
Has anyone had the same issue?
@PeterSR thank you for the tip yet again! I was indeed missing
imagePullSecretsin the deployment yaml.Was facing the same issue. The
refresh.shscript worked for me. Afterwards I was facing DNS resolution errors. All services would crash with errors similar toTo save others from 2 hours of debugging: Make sure that
corednshas 1/1 ready inkubectl -n kube-system get all. Its readiness probe had failed and logs showedDeleting the pod (forcing it to restart) solved the issue for me.
Got the idea to check
kube-systemfrom here and https://github.com/ubuntu/microk8s/issues/332#issue-413517185.Also noting that the script @ktsakalozos provided fixes the issue for me. Thank you!
Sorry for the late response. I tested the script above. new certs are valid until the year 2030.
all pods went into unknown state. at around 30 seconds later, all pods went up.
Thanks for the help!