CoreDNS的配置文件修改


今天浪费了4个小时来调整coredns 这里简单记录一下

  • 注意修改点:
  • 1 kubernetes cluster.local. 需要增加集群内的配置
  • 2 forward . /etc/resolv.conf 很多文档是 proxy 其实高版本早就改成了 forward
  • 3 clusterIP: 10.96.0.10 需要设置上具体的ip地址。
apiVersion: v1
kind: ServiceAccount
metadata:
name: coredns
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:coredns
rules:
- apiGroups:
- ""
resources:
- endpoints
- services
- pods
- namespaces
verbs:
- list
- watch
- apiGroups:
- discovery.k8s.io
resources:
- endpointslices
verbs:
- list
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
annotations:
rbac.authorization.kubernetes.io/autoupdate: "true"
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:coredns
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:coredns
subjects:
- kind: ServiceAccount
name: coredns
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
log
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local. {
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
forward . /etc/resolv.conf {
max_concurrent 1000
}
cache 30
reload
loadbalance
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: coredns
namespace: kube-system
labels:
k8s-app: kube-dns
kubernetes.io/name: "CoreDNS"
spec:
# replicas: not specified here:
# 1. Default is 1.
# 2. Will be tuned in real time if DNS horizontal auto-scaling is turned on.
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
selector:
matchLabels:
k8s-app: kube-dns
template:
metadata:
labels:
k8s-app: kube-dns
spec:
priorityClassName: system-cluster-critical
serviceAccountName: coredns
tolerations:
- key: "CriticalAddonsOnly"
operator: "Exists"
nodeSelector:
kubernetes.io/os: linux
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: k8s-app
operator: In
values: ["kube-dns"]
topologyKey: kubernetes.io/hostname
containers:
- name: coredns
image: coredns/coredns:1.8.4
imagePullPolicy: IfNotPresent
resources:
limits:
memory: 170Mi
requests:
cpu: 100m
memory: 70Mi
args: [ "-conf", "/etc/coredns/Corefile" ]
volumeMounts:
- name: config-volume
mountPath: /etc/coredns
readOnly: true
ports:
- containerPort: 53
name: dns
protocol: UDP
- containerPort: 53
name: dns-tcp
protocol: TCP
- containerPort: 9153
name: metrics
protocol: TCP
securityContext:
allowPrivilegeEscalation: false
capabilities:
add:
- NET_BIND_SERVICE
drop:
- all
readOnlyRootFilesystem: true
livenessProbe:
httpGet:
path: /health
port: 8080
scheme: HTTP
initialDelaySeconds: 60
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5
readinessProbe:
httpGet:
path: /ready
port: 8181
scheme: HTTP
dnsPolicy: Default
volumes:
- name: config-volume
configMap:
name: coredns
items:
- key: Corefile
path: Corefile
---
apiVersion: v1
kind: Service
metadata:
name: kube-dns
namespace: kube-system
annotations:
prometheus.io/port: "9153"
prometheus.io/scrape: "true"
labels:
k8s-app: kube-dns
kubernetes.io/cluster-service: "true"
kubernetes.io/name: "CoreDNS"
spec:
selector:
k8s-app: kube-dns
clusterIP: 10.96.0.10
ports:
- name: dns
port: 53
protocol: UDP
- name: dns-tcp
port: 53
protocol: TCP
- name: metrics
port: 9153
protocol: TCP

CoreDNS的配置文件修改的更多相关文章

  1. %appdata%目录下配置文件修改

    %appdata%目录下配置文件修改 1.假设%appdata%\leez Program目录下有Cache子目录和配置文件Config.ini内容为: [Version] Version=1.0.0 ...

  2. IDEA运行编译后配置文件无法找到,或配置文件修改后无效的问题

    1.触发事件 今天正好在学习log4j,为了测试其配置文件log4j.properties中的各种配置,进行了频繁修改和程序启动以确认效果,因为是使用的IDEA建立的Web项目,接着问题就来了,配置文 ...

  3. open-falcon Agent配置文件修改hostname后,还是有其他名称的endpoint

    问题 open-falcon Agent在配置文件修改hostname后,log日志中还是发现其他名称的endpoint. 原因 Graph, Gateway组件会引用goperfcounter(gi ...

  4. 在mysql配置文件修改sql_mode或sql-mode 怎么办?

    很多在安装程序配置数据库这一步中会出现: 请在mysql配置文件修改sql_mode或sql-mode 这个问题处理很简单: mysql中修改my.cnf,找到sql_mode,修改值为: NO_AU ...

  5. mysql配置文件修改

    mysql配置文件修改       mkdir –p /data/mysql chown -R mysql.mysql /data/mysql/     vim /etc/my.cnf [mysqld ...

  6. MySql绿色版安装步骤和方法,以及配置文件修改,Mysql服务器启动

    MySql绿色版Windows安装步骤和方法,以及配置文件修改,Mysql服务器启动 支持“标准”Markdown / CommonMark和Github风格的语法,也可变身为代码编辑器: 支持实时预 ...

  7. MySQL(二)之服务管理与配置文件修改和连接MySQL

    上一篇给大家介绍了怎么在linux和windows中安装mysql,本来是可以放在首页的,但是博客园说“安装配置类文件”不让放在首页.接下来给大家介绍一下在linux和windows下MySQL的一下 ...

  8. CentOS 7.4 ifconfig, ip/ss, nmcli, nmtui, 配置文件 修改ip信息用法

    CentOS 7.4 ifconfig, ip/ss, nmcli, nmtui, 配置文件 修改ip信息用法 CentOS 7.4 中, 网卡命名方式发生改变, 可预测功能命名: 网卡简要名称组成格 ...

  9. Day3作业:ha_proxy配置文件修改

    不废话,上代码 readme: # Auther:ccorz Mail:ccniubi@163.com Blog:http://www.cnblogs.com/ccorz/ # GitHub:http ...

  10. 报错——selinux配置文件修改错误导致无法启动虚拟机

    selinux配置文件修改错误导致无法启动虚拟机 问题 错误修改配置文件 [root@centos73 ~]# cat /etc/selinux/config # This file controls ...

随机推荐

  1. 十八般武艺玩转GaussDB(DWS)性能调优:Plan hint运用

    摘要:本文介绍GaussDB(DWS)另一种可以人工干预计划生成的功能--plan hint. 前言 数据库的使用者在书写SQL语句时,会根据自己已知的情况尽力写出性能很高的SQL语句.但是当需要写大 ...

  2. 一文解析Spring JDBC Template的使用指导

    摘要:Spring框架对JDBC的简单封装.提供了一个JDBCTemplate对象简化JDBC的开发. 本文分享自华为云社区<Spring JdbcTemplate使用解析>,作者: 共饮 ...

  3. 带你掌握如何使用CANN 算子ST测试工具msopst

    摘要:本期带您了解如何使用msopst工具. 本文分享自华为云社区<[CANN文档速递13期]算子ST测试工具[msopst]>,作者: 昇腾CANN . 如何获取msopst工具 mso ...

  4. storybook插件说明: integrations与addons推荐

    官方的: https://storybook.js.org/integrations/ https://github.com/storybookjs/storybook/blob/master/ADD ...

  5. 只需 3 步,人人都能搭建自己的 chatgpt 微信机器人

    大家好,我是徐公,大厂 6 年经验,CSDN 博客专家.最近,ChatGpt 很火,身边的人都在讨论,会不会成为下一个风口,像前几年互联网一样,迎来井喷式的发展. 徐公我最近也是在密切关注,最近,在 ...

  6. 白话 Pulsar Bookkeeper 的存储模型

    最近我们的 Pulsar 存储有很长一段时间数据一直得不到回收,但消息确实已经是 ACK 了,理论上应该是会被回收的,随着时间流逝不但没回收还一直再涨,最后在没找到原因的情况下就只有一直不停的扩容. ...

  7. #2028:Lowest Common Multiple Plus(n个数的最小公倍数)

    Problem Description 求n个数的最小公倍数. Input 输入包含多个测试实例,每个测试实例的开始是一个正整数n,然后是n个正整数. Output 为每组测试数据输出它们的最小公倍数 ...

  8. 第十二届蓝桥杯C++B组 A~H题题解

    本次题解格式参考 墨羽魂韶 本文所用的试题: 第十二届蓝桥杯大赛软件赛省赛_CB.pdf 最后编辑时间 2021年4月29日 21:27:46 2022 年 4月 8号 15点13分 填空题答案速览 ...

  9. 二分图的匹配 hdu 1083

    ***题意:n个学生,p门课,求最大匹配,即p门课是否都有人上*** 匈牙利算法 #include<iostream> #include<cstdio> #include< ...

  10. java基础(16)--super与this

    一.this简介 1.this.  this() 2.静态方法无法使用 3.不省略的情况:区分局部变量与实例变量,比如set方法中用到   二.super简介 1.只能出现在实例方法或构造方法中 2. ...