kubernetes更改coredns增加解析
作者:互联网
kubernetes更改coredns增加解析
k8s中coredns可以为全集群提供dns解析功能, 所以如果我们要手动增加dns解析, 只需在coredns中增加dns解析对即可
1. 编辑coredns
kubectl edit cm/coredns -n kube-system
apiVersion: v1
data:
Corefile: |
.:53 {
errors
health {
lameduck 5s
}
ready
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
fallthrough in-addr.arpa ip6.arpa
ttl 30
}
prometheus :9153
forward . /etc/resolv.conf {
max_concurrent 1000
}
cache 30
loop
reload
loadbalance
hosts { #增加 dns解析
150.158.179.155 jerry.plus
fallthrough
}
}
kind: ConfigMap
metadata:
creationTimestamp: "2022-03-04T15:36:40Z"
managedFields:
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:data: {}
manager: kubeadm
operation: Update
time: "2022-03-04T15:36:40Z"
- apiVersion: v1
fieldsType: FieldsV1
fieldsV1:
f:data:
f:Corefile: {}
manager: kubectl-edit
operation: Update
time: "2022-03-05T09:43:32Z"
name: coredns
namespace: kube-system
resourceVersion: "12284"
selfLink: /api/v1/namespaces/kube-system/configmaps/coredns
uid: 4da2236c-d3bc-43b4-8bdf-0a7a2a368c57
hosts {
150.158.179.155 jerry.plus
fallthrough
}
# 注意 hosts 增加与 prometheus 对齐
参考:https://www.jianshu.com/p/6999b185a2bc
标签:kubernetes,更改,arpa,v1,hosts,dns,coredns,解析 来源: https://www.cnblogs.com/jerry-0910/p/15968836.html