Unit needs restart after certificate change
Bug #1903077 reported by
Martin Kalcok
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Kubernetes Control Plane Charm |
Triaged
|
Medium
|
Unassigned |
Bug Description
kubernetes-master unit needs to be restarted after PKI change.
Even though the unit runs 'certificates-
Steps to reproduce:
* Deploy kubernetes-core bundle
* Wait for it to settle
* Remove Easyrsa application
* Deploy bundle again (this will redeploy easyrsa and generates new PKI)
* Deploy some kubernetes pods
* Observe pods being stuck in the 'Pending' state
* Run kubernetes-worker action 'restart'
* Observe pods getting properly deployed
To post a comment you must log in.
Thanks for the report and reproduction steps. I can reproduce this, although it appears to be a race condition so it might not reproduce with 100% certainty.
In my case, on kubernetes-master, both kube-controller -manager and kube-scheduler were failing to reach kube-apiserver due to "x509: certificate signed by unknown authority". This occurred because build_kubeconfig[1] ran before store_ca[2] and ca_written[3]. So while the charm did detect the change and restart services, it did so using kubeconfigs that were rendered with the old CA. On the next hook, it re-ran build_kubeconfig and rendered new kubeconfigs with the correct CA, but did not restart services.
To fix this, the charm's handling of the tls_client. ca.written flag will need to be adjusted to ensure new kubeconfigs are rendered before restarting the services.
[1]: https:/ /github. com/charmed- kubernetes/ charm-kubernete s-master/ blob/1467e9ba83 32c2959dd8f908a a29cee18f90e540 /reactive/ kubernetes_ master. py#L1912 /github. com/charmed- kubernetes/ layer-tls- client/ blob/9bfaafcd15 ecdbfb435fd35c2 8057372f7d62e2b /reactive/ tls_client. py#L19 /github. com/charmed- kubernetes/ charm-kubernete s-master/ blob/1467e9ba83 32c2959dd8f908a a29cee18f90e540 /reactive/ kubernetes_ master. py#L1159
[2]: https:/
[3]: https:/