当前位置:网站首页>The TOKEN value of Kubernetes joining the cluster expires
The TOKEN value of Kubernetes joining the cluster expires
2022-07-31 05:32:00 【hunheidaode】
When the init of the master node of the Kubernetes cluster is completed, the join command will be output so that users can use it to join other nodes, as follows
COPYkubeadm join 192.168.1.11:6443 --token abcdef.0123456789abcdef \--discovery-token-ca-cert-hash sha256:063cf8ade66033addf58f5d1a453aab0b1ec5ff023327bc10156935875baa7ad The validity period of the token value of the above command is only 24 hours. View through the following command, TTL is the validity period of the token
COPY$ kubeadm token listTOKEN TTL EXPIRES USAGES DESCRIPTION EXTRA GROUPS2tmuf8.gi... 23h 2021-01-25T1... authentication,signing The default bootstrap... system:bootstrappers:...How should the new node rejoin the cluster when the token after init expires
Add new master node
One thing to note here is that if
controlPlaneEndpointis not specified when deploying the cluster for init, a new master cannot be added. Generally, the value of this item isKeepalived VIP, orTheip:6443of a master is the api address of the cluster, otherwise an error will be reported when adding a new master.
Add controlPlaneEndpoint
If there is only one master node in the cluster, you can add the
controlPlaneEndpointparameter in the kube-apiserver. The value of this parameter is the master node ip.Skip if it is multi-master
COPY$ kubectl edit cm -n kube-system kubeadm-configapiVersion: v1data:ClusterConfiguration: |apiServer:extraArgs:authorization-mode: Node, RBACtimeoutForControlPlane: 4m0sapiVersion: kubeadm.k8s.io/v1beta2certificatesDir: /etc/kubernetes/pkiclusterName: kubernetescontrollerManager: {}dns:type: CoreDNSetcd:local:dataDir: /var/lib/etcdimageRepository: registry.aliyuncs.com/google_containerskind: ClusterConfigurationkubernetesVersion: v1.18.1# This location can add the address of the apiservercontrolPlaneEndpoint: "192.168.1.11:6443"...Generate add master command
COPY# To use certificate-key, so first generate certificate-key$ kubeadm init phase upload-certs --upload-certsI0217 01:23:50.056394 19222 version.go:252] remote version is much newer: v1.20.2; falling back to: stable-1.18W0217 01:23:52.864011 19222 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io][upload-certs] Storing the certificates in Secret "kubeadm-certs" in the "kube-system" Namespace[upload-certs] Using certificate key:0787d9b7f5abf63dd94570b1a8c6a2aa73421019bb45bd9a7ea24893f48e4ef9$ kubeadm token create --print-join-command --certificate-key=0787d9b7f5abf63dd94570b1a8c6a2aa73421019bb45bd9a7ea24893f48e4ef9W0217 01:24:22.855390 23471 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]# Execute the following command on the node to be joined to join the cluster and become the masterkubeadm join 192.168.1.11:6443 --token 0ysckj.3vtjwoa28dw1z8xz --discovery-token-ca-cert-hash sha256:c31906addf05434a967d68eb04a81fad38e90c04f2a86b899b5e41b1f919d3ae --control-plane --certificate-key 0787d9b7f5abf63dd94570b1a8c6a2aa73421019bb45bd9a7ea24893f48e4ef9Add a new node
COPY$ kubeadm token create --print-join-commandW0217 01:11:55.754155 73469 configset.go:202] WARNING: kubeadm cannot validate component configs for API groups [kubelet.config.k8s.io kubeproxy.config.k8s.io]# Execute the following command on the node to be joined, and it will join the cluster as a nodekubeadm join 192.168.1.11:6443 --token 67v2qk.vhylz26xsgwk5f2h --discovery-token-ca-cert-hash sha256:c31906addf05434a967d68eb04a81fad38e90c04f2a86b899b5e41b1f919d3aeOf course, you can also use the command generated by adding a new master to add a new node, as long as you don't add the --control-plane --certificate-key 0787d9b7f5abf63dd94570b1a8c6a2aa73421019bb45bd9a7ea24893f48e4ef9 part.
Recommendation
Whether you are building a single-master cluster or a multi-master cluster, add the controlPlaneEndpoint parameter
边栏推荐
- Temporal客户端模型
- Unity mobile game performance optimization series: performance tuning for the CPU side
- 数据库学习笔记
- Centos7 install mysql5.7 steps (graphical version)
- Anaconda configure environment directives
- <urlopen error [Errno 11001] getaddrinfo failed>的解决、isinstance()函数初略介绍
- Element concatenation operations in numpy and pytorch: stack, concatenat, cat
- 剑指offer基础版 --- 第21天
- About the problems encountered by Xiaobai installing nodejs (npm WARN config global `--global`, `--local` are deprecated. Use `--location=glob)
- 有了MVC,为什么还要DDD?
猜你喜欢

pycharm专业版使用

mysql stored procedure

Numpy中np.meshgrid的简单用法示例

Redis进阶 - 缓存问题:一致性、穿击、穿透、雪崩、污染等.

Swordsman Offer Special Assault Edition --- Day 3

MYSQL下载及安装完整教程

Goodbye to the cumbersome Excel, mastering data analysis and processing technology depends on it

docker安装postgresSQL和设置自定义数据目录

On-line monitoring system for urban waterlogging and water accumulation in bridges and tunnels
![[MQ I can speak for an hour]](/img/ef/863c994ac3a7de157bd39545218558.jpg)
[MQ I can speak for an hour]
随机推荐
剑指offer专项突击版 ---- 第2天
MySQL8.0.26安装配置教程(windows 64位)
<urlopen error [Errno 11001] getaddrinfo failed>的解决、isinstance()函数初略介绍
C语言实验二 数据类型、运算符和表达式
Input length must be multiple of 8 when decrypting with padded cipher
[mysql improves query efficiency] Mysql database query is slow to solve the problem
With MVC, why DDD?
Shell重油常压塔模拟仿真与控制
Interview Redis High Reliability | Master-Slave Mode, Sentinel Mode, Cluster Cluster Mode
SQL statement to range query time field
Refinement of the four major collection frameworks: Summary of List core knowledge
剑指offer专项突击版 ---- 第 6 天
Goodbye to the cumbersome Excel, mastering data analysis and processing technology depends on it
剑指offer基础版 ---- 第27天
精解四大集合框架:List 核心知识总结
a different object with the same identifier value was already associated with the session
MySQL-如何分库分表?一看就懂
C语言教程(二)-printf及c自带的数据类型
numpy和pytorch中的元素拼接操作:stack,concatenat,cat
The monitoring of Doris study notes