kubeadm token create command creates a new token, in this case without any description, so for you not to create any additional tokens, just pick the token which has a DESCRIPTION as mentioned in Step 2.
The kubeadm alpha certs certificate-key command will generate a new certificate key on demand as per the documentation here To Join a worker node, the command kubeadm token create --print-join-command given in the accepted answer is sufficient
7条答案
按热度按时间fcwjkofz1#
h4cxqtbf2#
要打印 * 新工作节点 * 的
join
命令,请用途:kubeadm token create --print-join-command
但是如果你需要加入一个 * 新的控制平面节点 *,你需要为控制平面
join
命令重新创建一个新的密钥。1.使用
kubeadm init phase upload-certs --upload-certs
在已经工作的主节点中重新上载证书。这将生成一个新的证书密钥。1.使用
kubeadm token create --print-join-command
在已经工作的主节点中打印join
命令。1.使用
$JOIN_COMMAND_FROM_STEP2 --control-plane --certificate-key $KEY_FROM_STEP1
加入新的控制平面节点。这可能不适用于旧的Kubernetes版本,但我尝试了新版本,它对我有效。
rvpgvaaj3#
To create
kubeadm join
command, please run the following commands:Step 1 - Retrieve Token CA Hash:
This command will provide you public key.
Step 2 - Retrieve bootstrap Tokens:
This will print all tokens, so copy the token value under
TOKEN
with the description "The default bootstrap token generated bykubeadm init
."Step 3 - Creates
kubeadm init
command:Now use following syntax to create
join
command without creating a new token:kubeadm token create
command creates a new token, in this case without any description, so for you not to create any additional tokens, just pick the token which has aDESCRIPTION
as mentioned in Step 2.wh6knrhe4#
在主节点计算机上运行以下命令。
此命令将生成新令牌以及join命令,您可以在工作节点上使用该命令加入集群。
bogh5gae5#
在@Abhishek Jain的答案的基础上,这里有一个脚本,在
jq
的帮助下打印kubeadm join
命令:8fsztsew6#
If you are joining control plane nodes, you will need a certificate key in the command too:
The
kubeadm alpha certs certificate-key
command will generate a new certificate key on demand as per the documentation hereTo Join a worker node, the command
kubeadm token create --print-join-command
given in the accepted answer is sufficienta14dhokn7#
Here is a bash script that automate this task