Skip to content

Instantly share code, notes, and snippets.

@aliasmee
Created October 26, 2020 10:28
Show Gist options
  • Save aliasmee/6c7e5fb433c8fd303b07f0081fc83677 to your computer and use it in GitHub Desktop.
Save aliasmee/6c7e5fb433c8fd303b07f0081fc83677 to your computer and use it in GitHub Desktop.
无法彻底清理cilium留下的问题
### 问题
在尝试安装完cilium之后,发现运行都crash,查看原因,是内核版本不匹配,需要4.xx,实际我的主机是3.10,所以先准备移除cilium,等待升完内核之后,再来安装。
简单使用
```bash
kubectl delete -f https://raw.githubusercontent.com/cilium/cilium/v1.8/install/kubernetes/quick-install.yaml
```
问题就这样出现了。表面上看似是从集群删除了。但是在其他容器重启或者更新发布之后,发现无法启动了,容器状态一直在containercreating状态。比如
```bash
NAME READY STATUS RESTARTS AGE
kibana-9b8ddf948-dn9z6 0/1 ContainerCreating 0 3m2s
```
describe的错误
```bash
Warning FailedCreatePodSandBox 3m33s kubelet, k8s-n1 Failed create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "95ca1afa6b039cb70085e4b9ef3bf99856bf74befdc626576ffa39cea233edf4" network for pod "kibana-9b8ddf948-xxbdx": NetworkPlugin cni failed to set up pod "kibana-9b8ddf948-xxbdx_default" network: unable to connect to Cilium daemon: failed to create cilium agent client after 30.000000 seconds timeout: Get "http:///var/run/cilium/cilium.sock/v1/config": dial unix /var/run/cilium/cilium.sock: connect: no such file or directory
```
### 解决方案
1. 找到这个存放[网络插件](https://kubernetes.io/zh/docs/concepts/extend-kubernetes/compute-storage-net/network-plugins/#cni)的目录下
```bash
ls /etc/cni/net.d/
05-cilium.conf 10-flannel.conflist
```
可以看到有俩文件在这里,而根据官方的说明,它会先加载`kubelet 将会使用按文件名的字典顺序排列的第一个作为配置文件`.所以就选择了05-cilium.conf。
2. 删除这个无用的文件
```bash
rm -f /etc/cni/net.d/05-cilium.conf
```
3. 删除之后,还需要重启下flannel。
```bash
kubectl rollout restart daemonsets kube-flannel-ds-amd64 -nkube-system
```
之后就可以看到容器可以正常的创建了。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment