首页 > 其他分享 >解决 [FATAL] plugin/loop: Loop (127.0.0.1:49443 -> :53) detected for zone "." 报错

解决 [FATAL] plugin/loop: Loop (127.0.0.1:49443 -> :53) detected for zone "." 报错

时间:2024-03-21 11:13:21浏览次数:39  
标签:systemd 127.0 zone etc resolv kubelet 报错 conf coredns

问题背景:

这个是安装k8s时报的错,安装使用的是ubuntu系统,当安装到coredns时报如下错

 

解决方法:

查找了一番资料,得出结论这个算是ubuntu和k8s coredns安装的一个兼容性问题,不过很好解决,参照coredns官方文档就可以~

首先贴出官网:https://coredns.io/plugins/loop/#troubleshooting

最下面有一段就是说这个问题

Troubleshooting Loops In Kubernetes Clusters

When a CoreDNS Pod deployed in Kubernetes detects a loop, the CoreDNS Pod will start to “CrashLoopBackOff”. This is because Kubernetes will try to restart the Pod every time CoreDNS detects the loop and exits.

A common cause of forwarding loops in Kubernetes clusters is an interaction with a local DNS cache on the host node (e.g. systemd-resolved). For example, in certain configurations systemd-resolved will put the loopback address 127.0.0.53 as a nameserver into /etc/resolv.conf. Kubernetes (via kubelet) by default will pass this /etc/resolv.conf file to all Pods using the default dnsPolicy rendering them unable to make DNS lookups (this includes CoreDNS Pods). CoreDNS uses this /etc/resolv.conf as a list of upstreams to forward requests to. Since it contains a loopback address, CoreDNS ends up forwarding requests to itself.

There are many ways to work around this issue, some are listed here:

  • Add the following to your kubelet config yaml: resolvConf: <path-to-your-real-resolv-conf-file> (or via command line flag --resolv-conf deprecated in 1.10). Your “real” resolv.conf is the one that contains the actual IPs of your upstream servers, and no local/loopback address. This flag tells kubelet to pass an alternate resolv.conf to Pods. For systems using systemd-resolved/run/systemd/resolve/resolv.conf is typically the location of the “real” resolv.conf, although this can be different depending on your distribution.
  • Disable the local DNS cache on host nodes, and restore /etc/resolv.conf to the original.
  • A quick and dirty fix is to edit your Corefile, replacing forward . /etc/resolv.conf with the IP address of your upstream DNS, for example forward . 8.8.8.8. But this only fixes the issue for CoreDNS, kubelet will continue to forward the invalid resolv.conf to all default dnsPolicy Pods, leaving them unable to resolve DNS.

他的意思是,ubuntu系统coredns的默认配置文件/etc/resolv.conf包含127.0.0.1地址,造成回环问题,解决方式就是让coredns读取到系统的真实配置文件 /run/systemd/resolve/resolv.conf 就可以

操作步骤如下,主要有两种方法

方法一、修改coredns的yaml配置文件

1.修改resolvConf参数为 /run/systemd/resolve/resolv.conf

vi /etc/kubernetes/kubelet-conf.yml

 2.重启kubelet

systemctl daemon-reload
systemctl restart kubelet

3.让coredns重载配置文件

kubectl edit deployment coredns -n kube-system

将replicates改为0,从而停止已经启动的coredns pod

kubectl edit deployment coredns -n kube-system

再将replicates改为2,触发coredns重新读取系统配置

4.检查服务状态为Running

kubectl get po -n kube-system

 

方法二、通过命令行参数 --resolv-conf

1.修改kubelet systemd配置文件(我是通过二进制方式安装的)

vi /etc/systemd/system/kubelet.service.d/10-kubelet.conf

在KUBELET_KUBECONFIG_ARGS后面插入 /run/systemd/resolve/resolv.conf

后面步骤和上面一样,不多做赘述

2.重启kubelet

3.让coredns重载配置文件

4.检查服务状态为Running

 

参考文档:

https://coredns.io/plugins/loop/#troubleshooting

https://blog.csdn.net/carry1beyond/article/details/88817462

https://blog.csdn.net/evanxuhe/article/details/90210764

标签:systemd,127.0,zone,etc,resolv,kubelet,报错,conf,coredns
From: https://www.cnblogs.com/allay/p/18086892

相关文章

  • vim 编辑报错导致无法正常退出和编辑
    vim编辑报错导致无法正常退出和编辑在使用Vi或Vim编辑器时,如果遇到错误,有时是因为非正常退出导致swap文件(.swp文件)的存在。以下是如何处理由swap文件引发的问题,以及删除swap文件这一解决方法:识别问题:当你试图打开一个之前未正常关闭的文件时,Vim会检测到与该文件关联......
  • python requests.post Max retries exceeded with url 报错
    python requests.post  Maxretriesexceededwithurl 报错 importrequestsfromrequests.adaptersimportHTTPAdapterfromrequests.packages.urllib3.util.retryimportRetrysession=requests.Session()retries=Retry(total=5,backoff_factor=0.1,st......
  • Yolov9报错“IndexError: list index out of range”方法解决
     哈喽友友们好!今天继续分享关于yolov9的使用教程。 在使用yolov9的数据集时,你是否有类似的报错?如图作者本人一直查找问题,开始是想着数据集标签可能有问题,于是就更换数据集直到适合为止。但发现很多数据集还是会报这个错,只有少部分才能运行,这个方法治标不治本。 于是......
  • Ubuntu上服务运行报错,No usable version of libssl was found
    运行服务时报错sudosystemctlstartComServer.servicesudosystemctlstatusComServer.service×ComServer.service-MESAPIservicesLoaded:loaded(/etc/systemd/system/ComServer.service;enabled;vendorpreset:enabled)Active:failed(Result:cor......
  • zabbix报错fping failed:no output
    zabbix的web前端界面突然连接不上了,页面一直转圈,无法响应,如下图: 排查思路如下:1、检查zabbix-server、Apache2、MySQL进程,发现都是active状态没有问题,端口号也正常2、查看zabbix-server日志文件,发现有报错,想着重启下zabbix-server进程,但是重启zabbix-server进程根本起不来,总......
  • dolphinscheduler调度任务执行hadoop命令报错(connot execute /opt/soft/hadoop/libexe
    问题描述在dolphinscheduler创建调度任务,任务里边命令为hadoopfs-mkdir-p/test/执行失败,报错信息如下:问题分析经排查该问题为dolphinscheduler配置的hadoop_home异常导致执行hadoop命令失败。问题解决配置dolphinscheduler服务config-env环境变量exportHADOOP_HOM......
  • PHP无法连接MySQL8.0数据库问题处理 报错如下: SQLSTATE[HY000]
    PHP无法连接MySQL8.0数据库问题处理报错如下:SQLSTATE[HY000][2054]Theserverrequestedauthenticationmethodunknowntotheclient发生这种错误,是由于MySQL8默认使用了新的密码验证插件:caching_sha2_password,而之前的PHP版本中所带的mysqlnd无法支持这种验证。解决这个问......
  • 240_@Override报错解决
    错误提示:@Overrideisnotallowedwhenimplementinginterfacemethod解决:修改模块编译检查时最低要求的JDK版本为JDK8......
  • 330_若依系统头像报错
    运行报错:clientBuilder.sslSocketFactory(SSLSocketFactory)notsupportedonJDK9+参考文档:https://www.cnblogs.com/mua9102/p/13387034.htmlprofile:/home/ruoyi/uploadPathbasedir:/data/apps/temp#项目相关配置ruoyi:#名称name:fgyw_corp#版本ve......
  • 【NodeJS】GLIBC_2.28 not found CentOS7不兼容Node高版本 npm报错
    CentOS7环境下安装Nvm,在执行nvmuse18.17.0后执行node-v爆出如下错误 bash复制代码node:/lib64/libm.so.6:version`GLIBC_2.27'notfound(requiredbynode)node:/lib64/libc.so.6:version`GLIBC_2.25'notfound(requiredbynode)node:/lib64/libc.so......