(转)CoreDNS介绍
转:https://www.colabug.com/4171614.html
本文介绍 CoreDNS 相关配置以及验证方法,实验环境为 Kubernetes 1.11,搭建方法参考 kubeadm安装kubernetes V1.11.1 集群
busybox 的槽点
开始之前先吐槽一下busybox中的 nslookup
命令。这个命令应该是实现的不是很完全,导致我在测试DNS的成功,得到了错误的信息。先来看一下
[root@devops-101 ~]# kubectl run busybox1 --rm -it --image=docker.io/busybox /bin/sh
If you don't see a command prompt, try pressing enter.
/ # nslookup kubernetes.default
Server: 172.17.0.10
Address: 172.17.0.10:53 ** server can't find kubernetes.default: NXDOMAIN *** Can't find kubernetes.default: No answer
看起来像是DNS没有响应,慢着,使用带nslookup的alphine试一下。
[root@devops-101 ~]# kubectl run dig --rm -it --image=docker.io/azukiapp/dig /bin/sh
If you don't see a command prompt, try pressing enter.
/ # dig @172.17.0.10 kubernetes.default.svc.cluster.local +noall +answer ; <> DiG 9.10.3-P3 <> @172.17.0.10 kubernetes.default.svc.cluster.local +noall +answer
; (1 server found)
;; global options: +cmd
kubernetes.default.svc.cluster.local. 5 IN A 172.17.0.1
/ # nslookup kubernetes.default
Server: 172.17.0.10
Address: 172.17.0.10#53 Name: kubernetes.default.svc.cluster.local
Address: 172.17.0.1 / # nslookup www.baidu.com
Server: 172.17.0.10
Address: 172.17.0.10#53 Non-authoritative answer:
www.baidu.com canonical name = www.a.shifen.com.
Name: www.a.shifen.com
Address: 220.181.112.244
Name: www.a.shifen.com
Address: 220.181.111.188 / # nslookup kubernetes.default
Server: 172.17.0.10
Address: 172.17.0.10#53 Name: kubernetes.default.svc.cluster.local
Address: 172.17.0.1
好好的啊!就是这个原因,busybox坑了我好几天。
CoreDNS
CoreDNS在Kubernetes1.11版本已经做为GA功能释放,成为Kubernetes默认的DNS服务替代了Ku be-DNS,目前是kubeadm、kube-up、minikube和kops安装工具的默认选项。
Stubdomain
and upstreamnameserver
in kube-dns translates to the proxy in CoreDNS. The federation
in kube-dns has an equivalent federation
in CoreDNS.
配置文件
使用kubeadm安装CoreDNS,会使用ConfigMap做为配置文件。这份配置文件,会默认使用宿主机的DNS服务器地址。
[root@devops-101 ~]# kubectl -n kube-system get configmap coredns -oyaml
apiVersion: v1
data:
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
}
kind: ConfigMap
metadata:
creationTimestamp: 2018-08-20T07:01:55Z
name: coredns
namespace: kube-system
resourceVersion: "193"
selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
uid: ec72baa4-a446-11e8-ac92-080027b7c4e9
配置文件各项目的含义
名称|含义
---|---
errors|错误会被记录到标准输出
health|可以通过http://localhost:8080/health查看健康状况
kubernetes|根据服务的IP响应DNS查询请求,kubeadm的 Cluster Domain
和 Service CIDR
默认为 cluster.local
和 10.95.0.0/12
,可以通过 --service-dns-domain
和 --service-cidr
参数配置。
prometheus|可以通过http://localhost:9153/metrics获取prometheus格式的监控数据
proxy|本地无法解析后,向上级地址进行查询,默认使用宿主机的 /etc/resolv.conf 配置
cache|缓存时间
检查COreDNS运行状况
检查Pod状态
[root@devops-101 ~]# kubectl -n kube-system get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE
coredns-78fcdf6894-52gp9 1/1 Running 4 4h 172.16.0.11 devops-101
coredns-78fcdf6894-mkvqn 1/1 Running 4 4h 172.16.0.10 devops-101
etcd-devops-101 1/1 Running 4 3h 192.168.0.101 devops-101
检查部署
[root@devops-101 ~]# kubectl -n kube-system get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
coredns 2 2 2 2 4h
验证可以采用本文刚开始部分提到的方法。
(转)CoreDNS介绍的更多相关文章
- CoreDNS介绍
本文介绍 CoreDNS 相关配置以及验证方法,实验环境为 Kubernetes 1.11,搭建方法参考kubeadm安装kubernetes V1.11.1 集群 busybox 的槽点 开始之前先 ...
- 【手打】coredns单台使用
目录: coredns介绍 coredns安装 corendns配置 coredns介绍 CoreDNS 其实就是一个 DNS 服务,而 DNS 作为一种常见的服务发现手段,所以很多开源项目以及工程师 ...
- Consul学习笔记(详细)
常见的注册中心: Netflix Eureka Alibaba Nacos HashiCorp Consul Apache Zookeeper CoreOS Etcd CNCF CoreDNS 介绍 ...
- Kubernetes系列之Coredns and Dashboard介绍篇
本次系列使用的所需部署包版本都使用的目前最新的或最新稳定版,安装包地址请到公众号内回复[K8s实战]获取 介绍 项目地址:https://github.com/coredns/coredns Core ...
- kubernetes之监控Prometheus实战--prometheus介绍--获取监控(一)
Prometheus介绍 Prometheus是一个最初在SoundCloud上构建的开源监控系统 .它现在是一个独立的开源项目,为了强调这一点,并说明项目的治理结构,Prometheus 于2016 ...
- Kubernetes系列之Helm介绍篇
本次系列使用的所需部署包版本都使用的目前最新的或最新稳定版,安装包地址请到公众号内回复[K8s实战]获取 介绍 Helm 是 Deis 开发的一个用于 Kubernetes 应用的包管理工具,主要用来 ...
- 二进制搭建kubernetes多master集群【开篇、集群环境和功能介绍】
本文主要说明kubernetes集群使用组建的版本和功能介绍.. 一.组件版本 Kubernetes 1.12.3 Docker 18.06.1-ce Etcd 3.3.10 Flanneld 0.1 ...
- Elastic Beats介绍
需要学习的地方:概念,用法,模块使用 Elastic Beats介绍 Elastic Stack传统上由三个主要组件(Elasticsearch,Logstash和Kibana)组成,早已脱离了这种组 ...
- kubernetes之coredns玩法
一.概述 新版本的kubernetes默认使用了coredns,这里就不赘述了.直达车:https://coredns.io/.https://kubernetes.io/docs/tasks/adm ...
随机推荐
- 配置OSPF认证
按照上图拓扑配置路由器的IP 配置完后测试直连网段连通性 搭建OSPF网络 注意是多区域的配置,R2是ABR 连着area0和area1 并且每个路由器的环回接口IP也要加进去 此时密码以明文方 ...
- Reverse Linked List(反转单向链表)
来源:https://leetcode.com/problems/reverse-linked-list Reverse a singly linked list. 递归方法:递归调用直到最后一个节点 ...
- 实验报告一 &第三周课程总结
实验报告 1.打印输出所有的“水仙花数”,所谓“水仙花数”是指一个3位数,其中各位数字立方和等于该数本身.例如,153是一个“水仙花数”. 实验代码: public class wdnmd{ publ ...
- .NET MVC Json()处理大数据异常解决方法
[1-部分原文]: .NET MVC Json()处理大数据异常解决方法 整个项目采用微软的ASP.NET MVC3进行开发,前端显示采用EasyUI框架,图表的显示用的是Highcharts,主要进 ...
- python 安装成windows服务
参考文档 https://blog.csdn.net/kongxx/article/details/65435076 https://www.cnblogs.com/lishuai0214/artic ...
- 探究Javascript模板引擎mustache.js使用方法
这篇文章主要为大家介绍了Javascript模板引擎mustache.js使用方法,mustache.js是一个简单强大的Javascript模板引擎,使用它可以简化在js代码中的html编写,压缩后 ...
- Codeforces 979D (STL set)(不用Trie简单AC)
题面: 传送门 题目大意: 给定一个空集合,有两种操作: 一种是往集合中插入一个元素x,一种是给三个数x,k,s,问集合中是否存在v,使得gcd(x,v)%k==0,且x+v<=s若存在多个满足 ...
- CSRF verification failed. Request aborted.错误解决办法
在Django项目的页面,提交form表单POST请求时,会出现报错:CSRF verification failed. Request aborted. 需要在form表单中加:{% csrf_to ...
- 基于 SwiftUI 创建一个可删除、可添加列表项的列表
执行环境 macOS Mojave: 10.14.5 xcode: Version 11.0 beta 6 (11M392q) 预览效果 完整代码 import SwiftUI class Item: ...
- python基础--4 元祖
#元组,元素不可被修改,不能被增加或者删除 #tuple,有序 tu=(11,22,33,44,55,33) #count 获取指定元素在元祖中出现的次数 print(tu.count(33)) #i ...