mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-23 11:00:25 +00:00
kubernetes: do not try to re-init the cluster on subsequent boots
If `kubelet.conf` already exits then don't try to redo `kubeadm`, no matter what the metadata requests. Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
parent
367c7e2c88
commit
6d387bf59d
@ -10,7 +10,12 @@ fi
|
|||||||
if [ -e /etc/kubelet.sh.conf ] ; then
|
if [ -e /etc/kubelet.sh.conf ] ; then
|
||||||
. /etc/kubelet.sh.conf
|
. /etc/kubelet.sh.conf
|
||||||
fi
|
fi
|
||||||
if [ -e /var/config/kubeadm/init ] ; then
|
|
||||||
|
conf=/var/lib/kubeadm/kubelet.conf
|
||||||
|
|
||||||
|
if [ -f "${conf}" ] ; then
|
||||||
|
echo "kubelet.sh: kubelet already configured"
|
||||||
|
elif [ -e /var/config/kubeadm/init ] ; then
|
||||||
echo "kubelet.sh: init cluster with metadata \"$(cat /var/config/kubeadm/init)\""
|
echo "kubelet.sh: init cluster with metadata \"$(cat /var/config/kubeadm/init)\""
|
||||||
# This needs to be in the background since it waits for kubelet to start.
|
# This needs to be in the background since it waits for kubelet to start.
|
||||||
# We skip printing the token so it is not persisted in the log.
|
# We skip printing the token so it is not persisted in the log.
|
||||||
@ -23,8 +28,6 @@ elif [ -e /var/config/userdata ] ; then
|
|||||||
kubeadm join --skip-preflight-checks $(cat /var/config/userdata)
|
kubeadm join --skip-preflight-checks $(cat /var/config/userdata)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
conf=/var/lib/kubeadm/kubelet.conf
|
|
||||||
|
|
||||||
echo "kubelet.sh: waiting for ${conf}"
|
echo "kubelet.sh: waiting for ${conf}"
|
||||||
# TODO(ijc) is there a race between kubeadm creating this file and
|
# TODO(ijc) is there a race between kubeadm creating this file and
|
||||||
# finishing the write where we might be able to fall through and
|
# finishing the write where we might be able to fall through and
|
||||||
|
Loading…
Reference in New Issue
Block a user