我正在尝试在k8s集群中创建一个rook集群。

设置-1个主节点,1个工作节点

这些是我遵循的步骤

Master node:
sudo kubeadm init --pod-network-cidr=10.244.0.0/16
sudo sysctl net.bridge.bridge-nf-call-iptables=1
sudo sysctl net.bridge.bridge-nf-call-ip6tables=1
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/32a765fd19ba45b387fdc5e3812c41fff47cfd55/Documentation/kube-flannel.yml
kubeadm token create --print-join-command

Worker node:
kubeadm join {master_ip_address}:6443 --token {token} --discovery-token-ca-cert-hash {hash} --apiserver-advertise-address={worker_private_ip}

Master node - Install rook - (reference - https://rook.github.io/docs/rook/master/ceph-quickstart.html):
kubectl create -f ceph/common.yaml
kubectl create -f ceph/operator.yaml
kubectl create -f ceph/cluster-test.yaml

创建rook-ceph-operator pod时出错:
(combined from similar events): Failed create pod sandbox: rpc error: code =
Unknown desc = failed to set up sandbox container "4a901f12e5af5340f2cc48a976e10e5c310c01a05a4a47371f766a1a166c304f"
network for pod "rook-ceph-operator-fdfbcc5c5-jccc9": networkPlugin cni failed to
set up pod "rook-ceph-operator-fdfbcc5c5-jccc9_rook-ceph" network: failed to set bridge addr:
"cni0" already has an IP address different from 10.244.1.1/24

kubernetes - 无法在K8S集群上安装Rook-LMLPHP

有人可以帮我解决这个问题吗?

最佳答案

如果您执行了kubeadm reset,然后开始重新初始化Kubernetes,则此问题开始。

kubeadm reset
systemctl stop kubelet
systemctl stop docker
rm -rf /var/lib/cni/
rm -rf /var/lib/kubelet/*
rm -rf /etc/cni/
ifconfig cni0 down
ifconfig flannel.1 down
ifconfig docker0 down

之后,再次启动docker和kubelet和kubeadm。

解决

您也可以尝试这种方式,作为简单易用的解决方案
ip link delete cni0
ip link delete flannel.1

这取决于您在k8s中使用哪个网络。

关于kubernetes - 无法在K8S集群上安装Rook,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/58072034/

10-16 18:16