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
[Bug]: k8s kube-apiserver fails to start after container restart due to missing /kind/kubeadm.conf #2410
If possible, I've reproduced the issue using the 'main' branch of this project
Steps to reproduce
Create a Kubernetes cluster:
container k8s create --name test-k8s
Verify that the cluster is healthy and kubectl responds normally:
kubectl get nodes
Restart the container (or reboot/sleep macOS), causing the container IP to change:
container stop test-k8s
container start test-k8s
Run any kubectl command:
kubectl get nodes
kubectl permanently hangs and times out:
Get "https://127.0.0.1:6445/api?timeout=32s": context deadline exceeded - read: connection reset by peer
Problem description
What happened
When a kindest/node container created by container k8s create is restarted and gets a new IP, kube-apiserver enters a CrashLoopBackOff and the API server never recovers.
Root cause
The underlying kindest/node image has an entrypoint (/usr/local/bin/entrypoint) that detects IP changes and invokes fix_certificate().
This function removes /etc/kubernetes/pki/apiserver.{crt,key} and attempts to re-generate the serving certificates using:
However, Apple's container k8s create writes the kubeadm configuration solely to /etc/kubernetes/kubeadm-config.yaml and does not provide /kind/kubeadm.conf.
As a result:
fix_certificate() fails with open /kind/kubeadm.conf: no such file or directory.
The existing apiserver certificates have already been deleted.
kube-apiserver crashes due to missing certificates, causing kubectl commands to hang indefinitely.
Expected behavior
The control plane node should provide /kind/kubeadm.conf (e.g. symlinked to /etc/kubernetes/kubeadm-config.yaml) so that the kind entrypoint can successfully regenerate certificates upon reboot.
Activity