[kubernetes]Error from server (BadRequest):container install-cni is not valid for pod kube-dns
安裝完 Flannel 網路元件之後,發現 pod kube-flannel 的狀態為 CrashLoopBackOff,執行命令檢視日誌,提示如下資訊:
Error from server (BadRequest): container install-cni is not valid for pod kube-dns-6f4fd4bdf-qdhqb
出現這個是因為 pod kube-flannel 啟動了兩個容器 kube-flannel 和 install-cni,檢視日誌時需要指定檢視那個容器,可通過命令 -c <container_name> 指定,例如: kubectl logs -f pods/kube-flannel-ds-vkdzw -c install-cni -n kube-system。通過命令可以看到報錯資訊如下:
+ cp -f /etc/kube-flannel/cni-conf.json /etc/cni/net.d/10-flannel.conf
cp: can't create '/etc/cni/net.d/10-flannel.conf': Permission denied
這個是因為容器跟主機檔案系統有互動操作,需要關閉 SELinux,執行如下命令即可:
[apps@mvxl1484 ~]$ sudo su -
[root@mvxl1484 ~]# setenforce 0
setenforce: SELinux is disabled
[root@mvxl1484 ~]# systemctl daemon-reload
檢視pod執行情況:
[apps@mvxl1484 ~]$ kubectl get pod --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system etcd-mvxl1484 1/1 Running 0 50m
kube-system kube-apiserver-mvxl1484 1/1 Running 0 50m
kube-system kube-controller-manager-mvxl1484 1/1 Running 0 50m
kube-system kube-dns-6f4fd4bdf-qdhqb 2/3 CrashLoopBackOff 21 50m
kube-system kube-flannel-ds-7248h 1/1 Running 0 38m
kube-system kube-flannel-ds-bzdg4 1/1 Running 0 38m
刪除有問題的pod,會自動重新安裝
[apps@mvxl1484 ~]$ kubectl delete pod kube-dns-6f4fd4bdf-qdhqb -n kube-system
pod "kube-dns-6f4fd4bdf-qdhqb" deleted
再看,已經正常
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system etcd-mvxl1484 1/1 Running 0 51m
kube-system kube-apiserver-mvxl1484 1/1 Running 0 51m
kube-system kube-controller-manager-mvxl1484 1/1 Running 0 51m
kube-system kube-dns-6f4fd4bdf-4jj56 2/3 Running 0 55s
kube-system kube-flannel-ds-7248h 1/1 Running 0 39m
kube-system kube-flannel-ds-bzdg4 1/1 Running 0 39m
相關文章
- kubernetes實踐之三十九:Pod初始化容器之Init ContainerAI
- kubernetes實踐之九:kube-dnsDNS
- Caused by: Error: ' ' is not a valid resource name characterError
- kubernetes CNI(Container Network Inferface)AI
- kubernetes container device interface (CDI)AIdev
- Networking from the container's point of view 筆記AIView筆記
- cURL error 52: Empty reply from server GitHub 三方登入報錯ErrorServerGithub
- kubernetes之初始容器(init container)AI
- ERROR | [iOS] unknown: Encountered an unknown error (Could not find a `ios` simulator (valid values:ErroriOS
- Error response from daemon: user declined directory sharing G:Config-Centerconfig acos-server.propertiesErrorServer
- 傲視Kubernetes(三):Kubernetes中的Pod
- Kubernetes之Pod排程
- Kubernetes Pod驅逐策略
- kubernetes之pod中斷
- Kubernetes:Pod總結(二)
- Kubernetes Pod 全面知識
- Kubernetes部署單元-Pod
- Kubernetes之Pod工作負載負載
- Kubernetes Pod OOM 排查日記OOM
- Kubernetes的Pod進階(十一)
- Kubernetes:Pod 升級、回滾
- Kubernetes:28---pod託管(Job:任務型pod)
- find the replications and articles from distribution serverServer
- MySQL案例09:Last_IO_Error: Got fatal error 1236 from master when reading data from binary logMySqlASTErrorGo
- kubernetes-pod驅逐機制
- kubernetes如何訪問pod服務
- Kubernetes-POD的健康檢查
- 詳解Kubernetes Pod優雅退出
- 技術分享 | kubernetes pod 簡介
- Docker run OGG Classic Architecture container from CIFS with docker-volume-netshDockerAI
- Windows Server 2019 container容器化-Docker安裝WindowsServerAIDocker
- 解決docker: Error response from daemon故障DockerError
- mysqldump: Error: Binlogging on server not activeMySqlErrorServer
- Microsoft SQL Server, Error: 15128 ()ROSSQLServerError
- Kubernetes(k8s)如何使用kube-dns實現服務發現K8SDNS
- Kubernetes Metrics Server元件Server元件
- api-server-pod-重啟失敗APIServer
- kubernetes雜談之(二)Pod初談