如何正确重新创建kubeadm 1.15.0集群?

时间:2019-06-29 16:00:38

标签: kubernetes kubeadm

我已经在全新安装的Ubuntu 18.04.2 LTS上创建了1.15.0单节点kubeadm。然后,我删除了集群并重新创建了它。但是现在我不能再创建它了(我收到etcd的飞行前检查错误):

[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

我使用的命令是:

   # 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

我做错了吗?

1 个答案:

答案 0 :(得分:3)

我在版本1.15.0中遇到了相同的问题。我经常删除并重新创建集群。我将kubeadm版本升级到1.15.0时注意到了这个错误。您只需删除/var/lib/etcd目录就可以了。

您可以在此处找到有关该错误的更多信息:https://github.com/kubernetes/kubeadm/issues/1642