当前位置:网站首页>[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 .
边栏推荐
- 一文详解JackSon配置信息
- SIGGRAPH 2022 | 真实还原手部肌肉,数字人双手这次有了骨骼、肌肉、皮肤
- CAP:多重注意力机制,有趣的细粒度分类方案 | AAAI 2021
- A memory leak caused by timeout scheduling of context and goroutine implementation
- Global and Chinese market of music synthesizer 2022-2028: Research Report on technology, participants, trends, market size and share
- Global and Chinese markets of stainless steel barbecue ovens 2022-2028: Research Report on technology, participants, trends, market size and share
- The decline of China's product managers: starting from the nostalgia for jobs
- CAP:多重注意力机制,有趣的细粒度分类方案 | AAAI 2021
- 2021-04-27: if the adjacent position of a character does not have the same character
- Implement Domain Driven Design - use ABP framework - domain logic & application logic
猜你喜欢

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

I just came back from the Ali software test. I worked for Alibaba P7 in 3+1, with an annual salary of 28*15
MySQL進階系列:鎖-InnoDB中鎖的情况

存在安全隐患 部分冒险家混动版将召回

ZOJ - 4104 sequence in the pocket
Advanced programmers must know and master. This article explains in detail the principle of MySQL master-slave synchronization
![[interview high frequency questions] sequential DP questions with difficulty of 3/5 and direct construction](/img/32/720ffa63a90cd5d37460face3fde38.png)
[interview high frequency questions] sequential DP questions with difficulty of 3/5 and direct construction

一文详解JackSon配置信息

C. K-th not divisible by n (Mathematics + thinking) codeforces round 640 (Div. 4)

微信公众号调试与Natapp环境搭建
随机推荐
Goby+awvs realize attack surface detection
Fastjson vulnerability utilization techniques
用 Oasis 开发一个跳一跳(一)—— 场景搭建
【面试高频题】难度 3/5,可直接构造的序列 DP 题
找出隐形资产--利用Hosts碰撞突破边界
A new weapon to break the memory wall has become a "hot search" in the industry! Persistent memory enables workers to play with massive data + high-dimensional models
我与“Apifox”的网络情缘
Pytorch 转置卷积
MD5 verification based on stm32
日志记录真没你想的那么简单
2021-04-27: if the adjacent position of a character does not have the same character
[application recommendation] the hands-on experience and model selection suggestions of apifox & apipost in the recent fire
Two problems of qtreewidget returning as DLL in singleton mode
2021-05-04: given a non negative integer C, you need to judge whether there are two integers a and B, so that a*a+b*b=c.
Global and Chinese markets of natural insect repellents 2022-2028: Research Report on technology, participants, trends, market size and share
Transpose convolution explanation
I just came back from the Ali software test. I worked for Alibaba P7 in 3+1, with an annual salary of 28*15
MySQL InnoDB and MyISAM
B. Terry sequence (thinking + greed) codeforces round 665 (Div. 2)
Step by step import RHEL image to Tencent cloud