You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Understand best practices to avoid kubeadm cert expiration #155
ContainerIssues or pull requests relevant for Team 2: Container Infra and Toolingneeds refinementUser stories that need to be refined for further progress
So this is missing in the configuration. Also it would be recommended to set serverTLSBootstrap: true and to use a CSR controller so that also kubelet serving certificates are issued.
From Thorsten:
Yes, this is normal and and a normal task for the 2 day operations to upgrade the cluster. The docs[1] has any tasks in certain manner.
On newer kubeadm version the cmd has changed from alpha to stable so the kubeadm alpha certs ... has moved to kubeadm certs ... instead.
And be aware if there some other kubeconfigs in your cluster depends on certificates for accessing the kube-apiserver should be updated as well.
The configuration for the kubelet and the kubelet server tls certificates on the nodes.
kubeadm [alpha] certs renew has not taken care of the kubelet server certificate in /var/lib/kubelet/pki/kubelet.crt.
By switching on --rotate-server-certificates in /var/lib/kubelet/kubeadm-flags.env and restarting (systemctl restart kubelet) this can be addressed.
The CSR needs to be approved manually kubectl get csr; kubectl certificate approve <CSR>, as signing server certificates needs care (for security reasons).
For some reason, the signing still does not happen (soon) after approving, so we have a helper for this: SovereignCloudStack/k8s-cluster-api-provider#233
With fresh kubelet server certs (in /var/lib/kubelet/pki/kubelet-server-current.pem), most things seem to work again. kubectl logs works after a fresh restart but fails after a while on some controllers ...
ubuntu@capi-mgmtcluster:~$ k logs -n kube-system kube-controller-manager-testcluster-control-plane-x49h7
Error from server (InternalError): Internal error occurred: Authorization error (user=kube-apiserver-kubelet-client, verb=get, resource=nodes, subresource=proxy)
So somehow, kube-proxy is still confused about its authorization? Some certificate that kubeadm has overlooked (and not the kubelet server cert)?
The metrics service would not work either.
Notes:
This is an old cluster, using docker on the nodes (we don't do this since a long time) and k8s-1.18.x
I would like to rescue the config and artifacts stored in the harbor app there
We should avoid the need to manually intervene to keep clusters working, so enable cert rotation everywhere
We should add a test case, where we put a very short expiration on certs, so we are sure this works
kubeadm renews all the certificates during control plane upgrade. This feature is designed for addressing the simplest use cases; if you don't have specific requirements on certificate renewal and perform Kubernetes version upgrades regularly (less than 1 year in between each upgrade), kubeadm will take care of keeping your cluster up to date and reasonably secure.
Renew all certificates with kubeadm certs renew all
ContainerIssues or pull requests relevant for Team 2: Container Infra and Toolingneeds refinementUser stories that need to be refined for further progress
Activity
garloff commentedon Aug 9, 2022
From Sven:
See also https://kubernetes.slack.com/archives/C8TSNPY4T/p1644598355240599
Usually a rollout is triggered. However, I see that we do not set rotateCertifactes: true. https://github.com/SovereignCloudStack/k8s-cluster-api-provider/blob/master/terraform/files/template/cluster-template.yaml#L50-L68
So this is missing in the configuration. Also it would be recommended to set serverTLSBootstrap: true and to use a CSR controller so that also kubelet serving certificates are issued.
garloff commentedon Aug 9, 2022
From Thorsten:
Yes, this is normal and and a normal task for the 2 day operations to upgrade the cluster. The docs[1] has any tasks in certain manner.
On newer kubeadm version the cmd has changed from alpha to stable so the
kubeadm alpha certs ...has moved tokubeadm certs ...instead.And be aware if there some other kubeconfigs in your cluster depends on certificates for accessing the kube-apiserver should be updated as well.
The configuration for the kubelet and the kubelet server tls certificates on the nodes.
[1] https://kubernetes.io/docs/tasks/administer-cluster/kubeadm/kubeadm-certs/
garloff commentedon Aug 11, 2022
kubeadm [alpha] certs renewhas not taken care of the kubelet server certificate in/var/lib/kubelet/pki/kubelet.crt.By switching on
--rotate-server-certificatesin/var/lib/kubelet/kubeadm-flags.envand restarting (systemctl restart kubelet) this can be addressed.The CSR needs to be approved manually
kubectl get csr; kubectl certificate approve <CSR>, as signing server certificates needs care (for security reasons).For some reason, the signing still does not happen (soon) after approving, so we have a helper for this: SovereignCloudStack/k8s-cluster-api-provider#233
With fresh kubelet server certs (in
/var/lib/kubelet/pki/kubelet-server-current.pem), most things seem to work again.kubectl logsworks after a fresh restart but fails after a while on some controllers ...So somehow, kube-proxy is still confused about its authorization? Some certificate that kubeadm has overlooked (and not the kubelet server cert)?
The metrics service would not work either.
Notes:
garloff commentedon Aug 15, 2022
From Jonas (using external CA via vault for C&H cluster solution):
https://github.com/orgs/SovereignCloudStack/discussions/114
https://gitlab.com/yaook/k8s/-/merge_requests/553
batistein commentedon Aug 15, 2022
WIP not yet complete...
garloff commentedon Aug 22, 2022
Needs to be added in kubeadm's KUBELET EXTRA ARGS
garloff commentedon Aug 26, 2022
This issue is now a long collection, so let's track things in different issues:
ajfriesen commentedon Sep 12, 2022
Certificates in Kubernetes expire after 1 year.
What does a provider need to do in order to NOT run into a certificate issue?
Update the cluster at least once a year to rotate certificates automatically
Renew all certificates with
kubeadm certs renew allCertificate Authority expires
Another problem is that the CA might expire as well.
kubeadmdoes not have any tooling for this at the time of writinggarloff commentedon Sep 14, 2022
Thanks, Andrej, I will add this to the maintenance docs in k8s-cluster-api-provider repo!
garloff commentedon Sep 21, 2022
You can find your text in
https://github.com/SovereignCloudStack/k8s-cluster-api-provider/blob/main/doc/Maintenance_and_Troubleshooting.md