kubernetes: bookend kubeadm-init with stamp files.

It is possible to get rebooted halfway through the init process, after key
files like `/etc/kubernetes/kubelet.conf` have been created but before full
cluster setup is complete or networking is applied.

Right now the idempotency of kubeadm (or backing out from this half-way state
and resuming the initialisation) is not something I have investigated. By
dropped stamps before and after at least the situation will be somewhat
detectable/diagnosable so the user can e.g. nuke their persistent disk and
start again.

Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
Ian Campbell 2017-10-04 12:07:44 +01:00
parent 164c4a30f5
commit 4386cbcdf9

View File

@ -1,5 +1,6 @@
#!/bin/sh
set -e
touch /var/lib/kubeadm/.kubeadm-init.sh-started
kubeadm init --skip-preflight-checks --kubernetes-version @KUBERNETES_VERSION@ $@
for i in /etc/kubeadm/kube-system.init/*.yaml ; do
if [ -e "$i" ] ; then
@ -11,3 +12,4 @@ if [ -f /var/config/kubeadm/untaint-master ] ; then
echo "Removing \"node-role.kubernetes.io/master\" taint from all nodes"
kubectl taint nodes --all node-role.kubernetes.io/master-
fi
touch /var/lib/kubeadm/.kubeadm-init.sh-finished