kubernetes: coredns故障 /etc/coredns/Corefile问题

现象 coredns挂掉
在这里插入图片描述
查看日志报错
/etc/coredns/Corefile:3 -Error during parsing: Unknow driective ‘ready’
在这里插入图片描述
解决办法:
找到 coredns 挂载 Corefile的cm
kubectl describe pod/XXX -oyaml即可
在这里插入图片描述
查看corefile文件
在这里插入图片描述
发现第三行是个ready
删除ready 即可恢复环境
kubectl edit cm/coredns -n kube-system -oyaml
在这里插入图片描述
在这里插入图片描述

Name: coredns-89d676cd8-486sp Namespace: kube-system Priority: 2000000000 Priority Class Name: system-cluster-critical Service Account: coredns Node: node1/192.168.88.51 Start Time: Thu, 10 Jul 2025 23:38:44 -0400 Labels: k8s-app=kube-dns pod-template-hash=89d676cd8 Annotations: cni.projectcalico.org/containerID: 5acf0edb94d8daeb41a9ed052091283bb287dcd34d40328043bde3a768253d65 cni.projectcalico.org/podIP: 10.244.166.129/32 cni.projectcalico.org/podIPs: 10.244.166.129/32 Status: Running IP: 10.244.166.129 IPs: IP: 10.244.166.129 Controlled By: ReplicaSet/coredns-89d676cd8 Containers: coredns: Container ID: containerd://15ffa488d1a9eef70b17096eb0d485e85ca2ad3c36e9594287a4940ecd4f0018 Image: harbor:443/k8s/coredns:v1.11.1 Image ID: harbor:443/k8s/coredns@sha256:2169b3b96af988cf69d7dd69efbcc59433eb027320eb185c6110e0850b997870 Ports: 53/UDP, 53/TCP, 9153/TCP Host Ports: 0/UDP, 0/TCP, 0/TCP Args: -conf /etc/coredns/Corefile State: Terminated Reason: Error Exit Code: 1 Started: Thu, 10 Jul 2025 23:40:17 -0400 Finished: Thu, 10 Jul 2025 23:40:17 -0400 Last State: Terminated Reason: Error Exit Code: 1 Started: Thu, 10 Jul 2025 23:39:26 -0400 Finished: Thu, 10 Jul 2025 23:39:27 -0400 Ready: False Restart Count: 4 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-dlfjq (ro) Conditions: Type Status PodReadyToStartContainers True 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-dlfjq: 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.kubernetes.io/not-ready:NoExecute op=Exists for 300s node.kubernetes.io/unreachable:NoExecute op=Exists for 300s Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 96s default-scheduler Successfully assigned kube-system/coredns-89d676cd8-486sp to node1 Normal Pulling 95s kubelet Pulling image "harbor:443/k8s/coredns:v1.11.1" Normal Pulled 92s kubelet Successfully pulled image "harbor:443/k8s/coredns:v1.11.1" in 2.485s (2.485s including waiting) Normal Created 54s (x4 over 92s) kubelet Created container coredns Normal Started 54s (x4 over 92s) kubelet Started container coredns Normal Pulled 54s (x3 over 92s) kubelet Container image "harbor:443/k8s/coredns:v1.11.1" already present on machine Warning BackOff 18s (x12 over 91s) kubelet Back-off restarting failed container coredns in pod coredns-89d676cd8-486sp_kube-system(7e190bd0-f450-4277-96b6-3a8efe65a7c8) 帮我分析一下这个日志
07-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值