• 使用kubeadm 新加入节点(原始token过期后)---转发


    kubeadm join

    kubeadm init 安装完成后你会得到以下的输出,使用join指令可以新增节点到集群,此token 有效期为24小时

    You should now deploy a pod network to the cluster.
    Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
      https://kubernetes.io/docs/concepts/cluster-administration/addons/
    
    You can now join any number of machines by running the following on each node
    as root:
    
      kubeadm join 18.16.202.35:6443 --token zr8n5j.yfkanjio0lfsupc0 --discovery-token-ca-cert-hash sha256:380b775b7f9ea362d45e4400be92adc4f71d86793ba6aae091ddb53c489d218c
    

    kubeadm token

    在新节点没有拿到证书以前,新节点和api server的通信是通过token和ca的签名完成的,具体的步骤如下

    # 生成token
    [root@node1 flannel]# kubeadm  token create
    kiyfhw.xiacqbch8o8fa8qj
    [root@node1 flannel]# kubeadm  token list
    TOKEN                     TTL         EXPIRES                     USAGES                   DESCRIPTION   EXTRA GROUPS
    gvvqwk.hn56nlsgsv11mik6   <invalid>   2018-10-25T14:16:06+08:00   authentication,signing   <none>        system:bootstrappers:kubeadm:default-node-token
    kiyfhw.xiacqbch8o8fa8qj   23h         2018-10-27T06:39:24+08:00   authentication,signing   <none>        system:bootstrappers:kubeadm:default-node-token
    
    # 生成ca的sha256 hash值
    [root@node1 flannel]# openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'
    5417eb1b68bd4e7a4c82aded83abc55ec91bd601e45734d6aba85de8b1ebb057
    
    # 组装join命令
    kubeadm join 18.16.202.35:6443 --token kiyfhw.xiacqbch8o8fa8qj --discovery-token-ca-cert-hash sha256:5417eb1b68bd4e7a4c82aded83abc55ec91bd601e45734d6aba85de8b1ebb057
    
    # 一步完成以上步骤
    kubeadm token create --print-join-command
    
    # 手动生成token,完成命令打印
    token=$(kubeadm token generate)
    kubeadm token create $token --print-join-command --ttl=0
  • 相关阅读:
    【2014 Multi-University Training Contest 3 1002】/【HDU 4888】 Redraw Beautiful Drawings
    8 shell命令之find
    [网络]_[0基础]_[使用putty备份远程数据]
    Cstyle的UEFI导读:第20.0篇 IGD OpRegion interface &amp;&amp; IGD OpRegion PROTOCOL
    Mac下使用MySQL
    Qt中截图功能的实现
    gdb经常使用命令总结
    Graphical Shell with WebShell
    SSH WebShell: SSH在线WEB管理器安装教程
    python—webshell_醉清风xf_新浪博客
  • 原文地址:https://www.cnblogs.com/xiaoyaojinzhazhadehangcheng/p/11605934.html
Copyright © 2020-2023  润新知