问题
I've created a 1.15.0 single-node kubeadm on a fresh installed Ubuntu 18.04.2 LTS. Then I deleted the cluster and recreated it. But now I can't recreate it anymore (I get etcd preflight-check error):
[init] Using Kubernetes version: v1.15.0
[preflight] Running pre-flight checks
[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
error execution phase preflight: [preflight] Some fatal errors occurred:
[ERROR DirAvailable--var-lib-etcd]: /var/lib/etcd is not empty
The commands that I've used are:
# created a single node
sudo swapoff -a
sudo kubeadm init --pod-network-cidr=192.168.0.0/16
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
curl https://docs.projectcalico.org/v3.7/manifests/calico.yaml -O
kubectl apply -f calico.yaml
kubectl taint nodes --all node-role.kubernetes.io/master-
# reseted a single node
sudo kubeadm reset
rm -fr .kube/
# recreated a single node
sudo kubeadm init --pod-network-cidr=192.168.0.0/16
Did I do something wrong?
回答1:
I encountered the same problem with version 1.15.0
. I often delete and recreate clusters. I noticed this bug when I upgraded kubeadm
version to 1.15.0
. You can just delete the /var/lib/etcd
directory and you are good to go.
You can find more about the bug here: https://github.com/kubernetes/kubeadm/issues/1642
来源:https://stackoverflow.com/questions/56818952/how-to-correctly-recreate-a-kubeadm-1-15-0-cluster