Files
k8s-docs/k8s/xiongxiao.me/docs/10-resolve.md
2025-11-27 14:25:56 +08:00

24 lines
702 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# dns 错误
当你在 Kubernetes 集群中遇到 DNS 解析错误时,可以尝试以下步骤来解决问题:
1. **检查 CoreDNS 状态**
确保 CoreDNS Pod 正在运行且没有错误。使用以下命令检查 CoreDNS Pod 的状态:
```bash
kubectl get pods -n kube-system -l k8s-app=kube-dns
```
如果 Pod 处于 CrashLoopBackOff 或其他错误状态,查看日志以获取更多信息:
```bash
kubectl logs -n kube-system -l k8s-app=kube-dns
```
2. 修改 /etc/resolv.conf 文件
```bash
sudo vim /etc/systemd/resolved.conf
# 修改 DNS 服务器地址
DNS=223.5.5.5 223.6.6.6
# 重启 systemd-resolved 服务
sudo systemctl restart systemd-resolved
```