当前位置: 首页 > news >正文

failed: open /etc/resolv.conf: no such file or directory“ cause k8s init failed

kubeadm init报错

kubeadm init --config /etc/kubernetes/kubeadm.conf -v 4 --skip-phases=addon/kube-proxy

This can take up to 4m0s", “[kubelet-check] Initial timeout of 40s passed.”, “”, “\tUnfortunately, an error has occurred:”, “\t\ttimed out waiting for the condition”, “”, “\tThis error is likely caused by:”, “\t\t- The kubelet is not running”, “\t\t- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)”, “”, “\tIf you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:”, “\t\t- ‘systemctl status kubelet’”, “\t\t- ‘journalctl -xeu kubelet’”, “”, “\tAdditionally, a control plane component may have crashed or exited when started by the container runtime.”, “\tTo troubleshoot, list all containers using your preferred container runtimes CLI.”, “”, “\tHere is one example how you may list all Kubernetes containers running in docker:”, “\t\t- ‘docker ps -a | grep kube | grep -v pause’”, “\t\tOnce you have found the failing container, you can inspect its logs with:”, “\t\t- ‘docker logs CONTAINERID’”]}

排查

systemctl status kubeletcat /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.confjournalctl -xeu kubeletdocker ps -a | grep kube | grep -v pausecat /etc/docker/daemon.json

根因

The error message “failed: open /etc/resolv.conf: no such file or directory” can be a cause for Kubernetes (k8s) init failure because Kubernetes relies on DNS resolution to function properly, and the missing “/etc/resolv.conf” file can prevent DNS resolution.

To fix this issue, you can try the following steps:

Check if the file exists: Run the following command in the terminal: ls /etc/resolv.conf. If the file exists, it should display the file name. If it doesn’t exist, you’ll need to recreate the file.

Recreate the file: Run the following command in the terminal: sudo touch /etc/resolv.conf. This will create an empty file with the correct name.

Configure the file: You’ll need to add the DNS server information to the file. You can do this by editing the file with a text editor such as nano or vi. Here’s an example of what the file might look like:

nameserver 8.8.8.8
nameserver 8.8.4.4

In this example, we’re using Google’s public DNS servers. You can use any DNS servers you like.

Save the file: Once you’ve added the DNS server information, save the file and exit the text editor.

Restart Kubernetes: After completing these steps, restart Kubernetes by running the appropriate command for your setup. For example, if you’re using kubeadm, you can run sudo systemctl restart kubelet to restart the Kubernetes service.

After completing these steps, try initializing Kubernetes again and see if the error message has been resolved. If you’re still encountering issues, there may be other underlying issues that need to be addressed.

http://www.lryc.cn/news/56329.html

相关文章:

  • 「科普」如何评价供应商的MES系统
  • 海康3D轮廓仪调试详细步骤
  • 【Linux】PCB(进程控制块)
  • 风电的Weibull分布及光电的Beta分布组合研究(Matlab代码实现)
  • 《Effective Objective-C 2.0 》 阅读笔记 item11
  • Python常见装饰器使用(实用向)
  • 集合详解之(三)单列集合接口Set及具体子类HashSet、TreeSet
  • 力扣刷题笔记22—— 矩阵中的路径(回溯)/pair的学习
  • Spring学习1
  • Keep再闯IPO,三年亏损16亿,会员留存率跌破70%
  • 软件测试分类详解
  • 网站怎么优化出排名
  • h5|web页面嵌套iframe传参给cocosCreator
  • 阿里云安全产品Web应用防火墙是什么?有什么作用?
  • 【SSM】Spring6(九.代理模式)
  • 【1017. 负二进制转换】
  • C语言实现插入排序与希尔排序
  • 第九章-DOM与CSS
  • 蓝桥杯真题练习
  • 插入排序的简单理解
  • Springboot框架集成Websocket通信方式
  • 将json数据分组
  • 从零开始实现一个C++高性能服务器框架----Socket模块
  • ld: library not found for -lcrt0.o
  • 接口测试和功能测试的区别有哪些?说一些你不知道的知识
  • 深度学习实战——不同方式的模型部署(CNN、Yolo)
  • 【论文阅读】GNN阅读笔记
  • QT常用控件——QTreeWidget(树控件),QTableWidget控件
  • 为什么学校购买小型数控机床而不是大型工业数控机床?
  • 【Go自学】一文搞懂Go append方法