Worker nodes lose control plane connection after snap restart
Description:
When executing sudo snap restart microk8s on a worker node, the kubeconfig
files are regenerated with 127.0.0.1 instead of the control plane IP, causing
the worker to become unhealthy.
Root Cause: The restart process calls create_user_certs_and_configs() which uses create_user_kubeconfigs() (designed for control plane) instead of create_worker_kubeconfigs() (designed for workers).
Expected Behavior: Worker nodes should maintain their connection to the control plane after restart.
Actual Behavior: Worker nodes regenerate kubeconfig with localhost, breaking cluster connectivity.
Affected Files:
- /var/snap/microk8s/current/credentials/kubelet.config
- /var/snap/microk8s/current/credentials/client.config
Proposed Fix: Detect worker node configuration (--start-control-plane=false) and call create_worker_kubeconfigs() with the stored control plane IP.
MicroK8s Version: 1.32/stable 8355
Source: canonical/microk8s