博客
关于我
CoreDNS介绍
阅读量:421 次
发布时间:2019-03-06

本文共 1359 字,大约阅读时间需要 4 分钟。

CoreDNS配置与验证指南

busybox的槽点

在开始使用CoreDNS之前,确保你的环境配置正确是关键。某些工具如busybox的nslookup命令可能会给你带来不便。例如,运行以下命令可能会返回错误信息:

kubectl run busybox1 --rm -it --image=docker.io/busybox /bin/sh

如果发现nslookup命令无法正常查询到kubernetes.default,尝试使用更现代化的dig命令进行验证:

kubectl run dig --rm -it --image=docker.io/azukiapp/dig /bin/sh

通过dig命令可以更直观地观察DNS解析情况。


CoreDNS概述

CoreDNS自Kubernetes 1.11版本起正式GA发布,取代了传统的kube-dns,成为Kubernetes生态系统的默认DNS解决方案。CoreDNS支持与Kubernetes服务集成,能够自动处理Cluster Domain和Service CIDR配置。


配置文件解析

CoreDNS的配置主要通过ConfigMap进行管理。默认配置文件如下:

# kubectl -n kube-system get configmap coredns -oyamlapiVersion: v1data:  Corefile: |    .:53 {        errors        health        kubernetes cluster.local in-addr.arpa ip6.arpa {            pods insecure            upstream            fallthrough in-addr.arpa ip6.arpa        }        prometheus: 9153        proxy . /etc/resolv.conf        cache 30        reload    }

配置选项说明

项目 含义
errors 记录DNS解析错误信息
health 提供健康检查端口(http://localhost:8080/health)
kubernetes 自动解析Kubernetes服务域名和IP范围,默认为cluster.local10.95.0.0/12
prometheus 启用Prometheus监控(默认端口:9153)
proxy 使用宿主机resolv.conf解析未知域名
cache DNS缓存时间(30秒)
reload 配置更改后自动重新加载CoreDNS

检查CoreDNS运行状态

确保CoreDNS组件正常运行是验证配置的关键步骤。

查看Pod状态

kubectl -n kube-system get pods -o wide

查看部署状态

kubectl -n kube-system get deployments

参考资料

  • Kubernetes官方文档:CoreDNS配置
  • CoreDNS GitHub仓库:CoreDNS源码
  • Kubernetes Best Practices:DNS配置
  • 转载地址:http://jqrkz.baihongyu.com/

    你可能感兴趣的文章
    No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
    查看>>
    No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
    查看>>
    No Feign Client for loadBalancing defined. Did you forget to include spring-cloud-starter-loadbalanc
    查看>>
    No mapping found for HTTP request with URI [/...] in DispatcherServlet with name ...的解决方法
    查看>>
    No module named cv2
    查看>>
    No module named tensorboard.main在安装tensorboardX的时候遇到的问题
    查看>>
    No module named ‘MySQLdb‘错误解决No module named ‘MySQLdb‘错误解决
    查看>>
    No new migrations found. Your system is up-to-date.
    查看>>
    No qualifying bean of type XXX found for dependency XXX.
    查看>>
    No resource identifier found for attribute 'srcCompat' in package的解决办法
    查看>>
    No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
    查看>>
    NO.23 ZenTaoPHP目录结构
    查看>>
    NO32 网络层次及OSI7层模型--TCP三次握手四次断开--子网划分
    查看>>
    NoClassDefFoundError: org/springframework/boot/context/properties/ConfigurationBeanFactoryMetadata
    查看>>
    Node JS: < 一> 初识Node JS
    查看>>
    Node-RED中使用JSON数据建立web网站
    查看>>
    Node-RED中使用json节点解析JSON数据
    查看>>
    Node-RED中使用node-red-browser-utils节点实现选择Windows操作系统中的文件并实现图片预览
    查看>>
    Node-RED中使用Notification元件显示警告讯息框(温度过高提示)
    查看>>
    Node-RED中实现HTML表单提交和获取提交的内容
    查看>>