AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1081685
Accepted
Daigo
Daigo
Asked: 2021-10-26 18:04:04 +0800 CST2021-10-26 18:04:04 +0800 CST 2021-10-26 18:04:04 +0800 CST

kubernetes coredns 处于 CrashLoopBackOff 状态,出现“未找到名称服务器”错误

  • 772

我曾尝试在我的裸机服务器上使用 kubeadm 构建 kubernetes,并将 containerd 作为 cri,但似乎 coredns 在安装 cni(weave-net)后无法启动。

两个 coredns 容器现在处于“CrashLoopBackOff”状态,它们的日志是:

plugin/forward: no nameservers found

而“kubectl describe pod”的描述如下:

Events:
  Type     Reason            Age                    From               Message
  ----     ------            ----                   ----               -------
  Warning  FailedScheduling  4m52s (x9 over 13m)    default-scheduler  0/1 nodes are available: 1 node(s) had taint {node.kubernetes.io/not-ready: }, that the pod didn't tolerate.
  Normal   Scheduled         4m7s                   default-scheduler  Successfully assigned kube-system/coredns-58cf647449-8pq7k to k8s
  Normal   Pulled            3m13s (x4 over 4m6s)   kubelet            Container image "localhost:5000/coredns:v1.8.4" already present on machine
  Normal   Created           3m13s (x4 over 4m6s)   kubelet            Created container coredns
  Normal   Started           3m13s (x4 over 4m6s)   kubelet            Started container coredns
  Warning  Unhealthy         3m13s                  kubelet            Readiness probe failed: Get "http://10.32.0.3:8181/ready": dial tcp 10.32.0.3:8181: connect: connection refused
  Warning  BackOff           2m54s (x12 over 4m5s)  kubelet            Back-off restarting failed container

如果我在 /etc/resolv.conf 上添加一些设置,例如“nameserver 8.8.8.8”,coredns pods 就会开始运行。但是,目前我根本不使用任何外部 dns,并且使用 Docker 作为 cri,虽然 /etc/resolv.conf 上没有设置,但 coredns 运行良好。

是否可以在不在 resolv.conf 上设置一些上游 dns 服务器的情况下处理这个问题?

服务器信息:

OS: RedHat Enterprise Linux 8.4
cri: containerd 1.4.11
cni: weave-net 1.16
tools: kubeadm, kubectl, kubelet 1.22.1

我也尝试过使用 calico 作为 cni,但结果是一样的。

domain-name-system kubernetes kubeadm
  • 2 2 个回答
  • 1460 Views

2 个回答

  • Voted
  1. Best Answer
    Daigo
    2021-11-01T23:22:11+08:002021-11-01T23:22:11+08:00

    原因是 coredns 默认在其 ConfigMap 上有一个转发设置。尽管 /etc/resolv.conf 上没有 DNS 设置,但它试图将请求转发到上游 DNS 服务器。

    # kubectl edit configmap coredns -n kube-system
    

    删除以下部分后,它开始并正常工作。

        forward . /etc/resolv.conf {
           max_concurrent 1000
        }
    
    • 3
  2. mona moghadampanah
    2022-07-25T09:21:40+08:002022-07-25T09:21:40+08:00

    我更改了 coredns configmap 中的以下部分:

    forward . /etc/resolv.conf {
       max_concurrent 1000
    }
    

    对此:

    forward . 8.8.8.8 {
           max_concurrent 1000
        }
    

    它有效。

    • 1

相关问题

  • Solaris DNS

  • resolv.conf 在经过一段时间后被更改

  • 为什么有些网站的网址中没有“www”就无法显示?[关闭]

  • 为本地网络中的名称解析添加自定义 dns 条目

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve