当前位置:网站首页>[tke] modify the cluster corendns service address
[tke] modify the cluster corendns service address
2022-06-24 16:16:00 【jokey】
Use scenarios
TKE Medium Coredns service IP At present, there is no way to specify when creating a cluster , It is configured from the customer by default Service CIDR A random... Is assigned to the network segment IP, The following describes how to customize and modify Coredns service IP.
Prerequisite
- In configuration service CIDR Select a network segment that is not currently used in the cluster IP
- Inventory in the cluster Pods It is acceptable to be rebuilt .
Operation steps
1. modify kubelet Launch parameters First, go to the stock node to modify kubelet In profile --cluster-dns The parameter is new Cluster IP And restart kubelet, The operation command is as follows :
DNS_CLUSTER_IP=xxx.xxx.xxx.xxx
sed -i "/CLUSTER_DNS/c\CLUSTER_DNS=\"--cluster-dns=${DNS_CLUSTER_IP}\"" /etc/kubernetes/kubelet
systemctl restart kubelet2. Rebuild specifies a new ClusterIP Of Coredns Of Service resources
because .spec.clusterIP Fields are not modifiable , So you must delete the original Service resources :
kubectl delete svc kube-dns -n kube-system
And then recreate Service kube-dns, The following can be modified and applied according to the requirements YAML The reconstruction :
apiVersion: v1
kind: Service
metadata:
annotations:
prometheus.io/port: "9153"
prometheus.io/scrape: "true"
labels:
addonmanager.kubernetes.io/mode: Reconcile
kubernetes.io/cluster-service: "true"
kubernetes.io/name: CoreDNS
name: kube-dns
namespace: kube-system
spec:
clusterIP: xxx.xxx.xxx.xxx # The service you want to specify IP
ports:
- name: dns-tcp
port: 53
protocol: TCP
targetPort: 53
- name: dns
port: 53
protocol: UDP
targetPort: 53
selector:
k8s-app: kube-dns
sessionAffinity: None
type: ClusterIP3. Rebuild all the stocks in the cluster Pods
because kubelet Use --cluster-dns=<DNS service IP> The logo will DNS The parser information is passed to each container , So stock Pods It needs to be rebuilt and updated to the new Cluster IP, Use the normal delete command :
kubectl delete pod --all --all-namespaces
4. Specify... When creating a new node kubelet Parameters
When creating a new node, you can specify through the function of user-defined parameters kubelet In profile --cluster-dns Parameters , However, at present, you need to contact the after-sales students to open a white list, which can be configured on the console .
reminder : because Coredns Pods A special , stay Coredns When created, the container /etc/resolv.conf The default is to inherit from the same path of the current node Dnsservers To configure , Can't use kubelet Parameter , And it won't follow watch And synchronization nodes /etc/resolv.conf Changes to the contents of , Therefore, the configuration on the node needs to be rebuilt after modification coredns Pods Update new configuration .
边栏推荐
- 【应用推荐】最近大火的Apifox & Apipost 上手体验与选型建议
- Transpose convolution learning notes
- 【Prometheus】4. Monitoring cases
- Siggraph 2022 | truly restore the hand muscles. This time, the digital human hands have bones, muscles and skin
- Inter thread communication of embedded development foundation
- Implement Domain Driven Design - use ABP framework - domain logic & application logic
- Several characteristics of pharmaceutical industry
- [C language questions -- leetcode 12 questions] take you off and fly into the garbage
- 2021-05-02: given the path of a file directory, write a function
- Logging is not as simple as you think
猜你喜欢

构建Go命令行程序工具链

CAP:多重注意力机制,有趣的细粒度分类方案 | AAAI 2021

使用阿里云RDS for SQL Server性能洞察优化数据库负载-初识性能洞察

一文理解OpenStack网络
![[C language questions -- leetcode 12 questions] take you off and fly into the garbage](/img/ca/a356a867f3b7ef2814080fb76b9bfb.png)
[C language questions -- leetcode 12 questions] take you off and fly into the garbage

Several common DoS attacks

【云原生 | Kubernetes篇】Kubernetes基础入门(三)

nifi从入门到实战(保姆级教程)——环境篇

Wechat official account debugging and natapp environment building

一文详解JackSon配置信息
随机推荐
2021-04-22: given many line segments, each line segment has two numbers [start, end],
Kubernetes characteristic research: sidecar containers
存在安全隐患 部分冒险家混动版将召回
Global and Chinese market of insect proof clothing 2022-2028: Research Report on technology, participants, trends, market size and share
安装ImageMagick7.1库以及php的Imagick扩展
基于STM32的MD5校验
MySQL timestamp format conversion date format string
不忘初心
[C language questions -- leetcode 12 questions] take you off and fly into the garbage
企业安全攻击面分析工具
Install the imagemagick7.1 library and the imageick extension for PHP
How to open a futures account safely? Which futures companies are more reliable?
2021-04-25: given an array arr and a positive number m, the
Step by step import RHEL image to Tencent cloud
微信公众号调试与Natapp环境搭建
Convert text to hexadecimal, and reverse
ThinkPHP 漏洞利用工具
Transpose convolution explanation
Global and Chinese market of computer protective film 2022-2028: Research Report on technology, participants, trends, market size and share
Still worried about missing measurements? Let's use Jacobo to calculate the code coverage