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. 带你了解数据库的“吸尘器”:VACUUM

    摘要:在GaussDB(DWS)中,VACUUM的本质就是一个"吸尘器",用于吸收"尘埃". 下面将从VACUUM的作用.用法.原理等方面进行介绍. 在Gaus ...

  2. 一文带你认识MindSpore新一代分子模拟库SPONGE

    [本期推荐专题]物联网从业人员必读:华为云专家为你详细解读LiteOS各模块开发及其实现原理. 摘要:基于MindSpore自动并行.图算融合等特性,SPONGE可高效地完成传统分子模拟过程,利用Mi ...

  3. 面试官:说一下Jena推理

    摘要:本文介绍了Jena的推理子系统,并构建了一个简单的RDF图.基于该RDF图,我们搭建了一个Jena推理引擎,并进行自动化推理. 本文分享自华为云社区<知识推理之基于jena的知识推理(三) ...

  4. 实践GoF的设计模式:工厂方法模式

    摘要:工厂方法模式(Factory Method Pattern)将对象创建的逻辑封装起来,为使用者提供一个简单易用的对象创建接口,常用于不指定对象具体类型的情况下创建对象的场景. 本文分享自华为云社 ...

  5. 下一代APP Store——GPT应用商店GPTs初体验

    uploading-image-126879.png 近期,OpenAI宣布GPT应用商店正式上线,目前拥有plus的用户已经可以体验了. OpenAI将GPT应用商店命名为GPTs,这也是之前发布会 ...

  6. 无法安装此app,因为无法验证其完整性 ,解决方案

    最近有很多兄弟萌跟我反应"无法安装此app,因为无法验证其完整性 ",看来这个问题无法避免了,今天统一回复下,出现提示主要有以下几种可能 1.安装包不完整 首先申请我所有分享的破解 ...

  7. 学习 Java 还是 Solon 简单,v1.9.0 发布

    入手很简单哦: pom.xml 添加依赖 <dependency> <groupId>org.noear</groupId> <artifactId>s ...

  8. C# Task 多任务:C# 扩展TaskScheduler实现独立线程池,支持多任务批量处理,互不干扰,无缝兼容Task

    先上源码: https://gitee.com/s0611163/TaskSchedulerEx     为什么编写TaskSchedulerEx类? 因为.NET默认线程池只有一个线程池,如果某个批 ...

  9. spring管理实务有几种方式

    一:事务认识 大家所了解的事务Transaction,它是一些列严密操作动作,要么都操作完成,要么都回滚撤销.Spring事务管理基于底层数据库本身的事务处理机制.数据库事务的基础,是掌握Spring ...

  10. RSAC创新沙盒十强出炉,这家SCA公司火了

    引言 近日,全球网络安全行业创新风向标RSAC创新沙盒公布了本年度入围十强的名单,软件供应链安全企业Endor Labs凭借基于依赖关系建立应用开发生命周期的解决方案获得了广泛关注. Endor La ...