![如何解决状态为 ContainerCreating 的 coreDNS pod - kubernetes](https://linux22.com/image/777041/%E5%A6%82%E4%BD%95%E8%A7%A3%E5%86%B3%E7%8A%B6%E6%80%81%E4%B8%BA%20ContainerCreating%20%E7%9A%84%20coreDNS%20pod%20-%20kubernetes.png)
我希望有人能帮助我。
好吧,我正在使用 Gitlab、Gitlab-Runner、docker 和 Kubernetes 构建一个服务器(CentOS)到 CI/CD。
GitLab 信息
Version: 14.10.2
Revision: 07d12f3fd11
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 12.7
Gitlab运行器
Version: 14.10.1
Docker
Version: 20.10.15
Kubernetes
# kubectl version --short
Client Version: v1.24.0
Kustomize Version: v4.5.4
Server Version: v1.24.0
Weave 插件
# weave status
Version: 2.8.1 (failed to check latest version - see logs; next check at 2022/05/07 22:50:26)
Service: router
Protocol: weave 1..2
Name: 06:16:91:13:ce:26(srvppk.com.br)
Encryption: disabled
PeerDiscovery: enabled
Targets: 0
Connections: 0
Peers: 1
TrustedSubnets: none
Service: ipam
Status: ready
Range: 10.32.0.0/12
DefaultSubnet: 10.32.0.0/12
我在 coreDNS pod 中遇到一个问题,它的状态始终是容器创建。因此,我尝试了论坛上找到的几个解决方案,但都不起作用。见下文。
# kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-6d4b75cb6d-fmvwd 0/1 ContainerCreating 0 144m
kube-system coredns-6d4b75cb6d-jshz5 0/1 ContainerCreating 0 144m
kube-system etcd-srvppk.com.br 1/1 Running 10 144m
kube-system kube-apiserver-srvppk.com.br 1/1 Running 0 144m
kube-system kube-controller-manager-srvppk.com.br 1/1 Running 0 144m
kube-system kube-proxy-hnwfd 1/1 Running 0 144m
kube-system kube-scheduler-srvppk.com.br 1/1 Running 10 144m
kube-system weave-net-h6zdk 2/2 Running 0 135m
描述第一个 coredns
# kubectl describe pod/coredns-6d4b75cb6d-fmvwd -n kube-system
Name: coredns-6d4b75cb6d-fmvwd
Namespace: kube-system
Priority: 2000000000
Priority Class Name: system-cluster-critical
Node: srvppk.com.br/10.0.10.20
Start Time: Sat, 07 May 2022 12:29:14 -0400
Labels: k8s-app=kube-dns
pod-template-hash=6d4b75cb6d
Annotations: <none>
Status: Pending
IP:
IPs: <none>
Controlled By: ReplicaSet/coredns-6d4b75cb6d
Containers:
coredns:
Container ID:
Image: k8s.gcr.io/coredns/coredns:v1.8.6
Image ID:
Ports: 53/UDP, 53/TCP, 9153/TCP
Host Ports: 0/UDP, 0/TCP, 0/TCP
Args:
-conf
/etc/coredns/Corefile
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Limits:
memory: 170Mi
Requests:
cpu: 100m
memory: 70Mi
Liveness: http-get http://:8080/health delay=60s timeout=5s period=10s #success=1 #failure=5
Readiness: http-get http://:8181/ready delay=0s timeout=1s period=10s #success=1 #failure=3
Environment: <none>
Mounts:
/etc/coredns from config-volume (ro)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-gj9pl (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
config-volume:
Type: ConfigMap (a volume populated by a ConfigMap)
Name: coredns
Optional: false
kube-api-access-gj9pl:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: Burstable
Node-Selectors: kubernetes.io/os=linux
Tolerations: CriticalAddonsOnly op=Exists
node-role.kubernetes.io/control-plane:NoSchedule
node-role.kubernetes.io/master:NoSchedule
node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedCreatePodSandBox 2m52s (x565 over 125m) kubelet (combined from similar events): Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for sandbox "28664f04201a02833f7c3f9c19cebe6a3e9ae55849731d7ee643b3ad1825e6ab": failed to find network info for sandbox "28664f04201a02833f7c3f9c19cebe6a3e9ae55849731d7ee643b3ad1825e6ab"
我做错了什么?