添加节点

KubeCube 提供为已有集群添加节点的能力

⚠️ 注意 node 机器需要能够通过 ssh 访问 master 机器,支持公钥和密码两种 ssh 方式,执行脚本前可以在 node 上 ssh 到 master 测试连通性

向集群添加工作节点

在新节点上执行部署脚本

  1. KUBECUBE_VERSION=v1.0.0
  1. export CUSTOMIZE="true";curl -fsSL https://kubecube.nos-eastchina1.126.net/kubecube-installer/${KUBECUBE_VERSION}/entry.sh | bash

tip: 你可以通过预先下载离线包和镜像来减少部署时间

  1. export PRE_DOWNLOAD="true";curl -fsSL https://kubecube.nos-eastchina1.126.net/kubecube-installer/${KUBECUBE_VERSION}/entry.sh | bash

设置脚本参数,并按照提示继续运行安装脚本并等待新节点加入集群

  • MASTER_IP 为 master 节点 ip
  • LOCAL_IP 为新节点 ip
  1. # if install kubecube on pivot cluster
  2. INSTALL_KUBECUBE_PIVOT="false"
  3. # if install kubecube on member cluster
  4. INSTALL_KUBECUBE_MEMBER="false"
  5. # if install k8s
  6. INSTALL_KUBERNETES="true"
  7. # there are four node mode below:
  8. # "master" : node will be installed as a master of cluster
  9. # "node-join-master" : node will be install as a worker of cluster to join master
  10. # "control-plane-master" : node will be installed as a master to control plane of cluster
  11. # "node-join-control-plane" : node will be installed as a master to join control plane
  12. NODE_MODE="node-join-master"
  13. # +optional
  14. # must be set when INSTALL_KUBECUBE_MEMBER="true"
  15. # this value is the name of member cluster you
  16. # want to take over
  17. MEMBER_CLUSTER_NAME=""
  18. # +optional
  19. # must be set when NODE_MODE="control-plane-master"
  20. # or "node-join-control-plane"
  21. CONTROL_PLANE_ENDPOINT="" #{ip}:{port} , dns
  22. # master ip means master node ip of cluster
  23. MASTER_IP="10.173.32.4"
  24. # +optional
  25. # KUBECUBE_HOST must be set when as a member cluster to
  26. # join pivot cluster, the value is pivot node ip
  27. KUBECUBE_HOST=""
  28. # zone has two choice
  29. # 1. "cn" : in mainland
  30. # 2. "others" : out of mainland
  31. ZONE="cn"
  32. # k8s version you want to install
  33. KUBERNETES_VERSION="1.20.9"
  34. # +optional
  35. # the user who can access master node, it can be empty
  36. # when NODE_MODE="master" or "control-plane-master"
  37. MASTER_USER="root"
  38. # +optional
  39. # must be empty when ACCESS_PRIVATE_KEY_PATH set
  40. # password for master user to access master node
  41. ACCESS_PASSWORD=""
  42. # +optional
  43. # must be empty when ACCESS_PASSWORD set
  44. # ACCESS_PRIVATE_KEY for master user to access master node
  45. ACCESS_PRIVATE_KEY_PATH="/root/.ssh/id_rsa"

向集群的 control-plane 添加 master 节点

在新节点上执行部署脚本

  1. KUBECUBE_VERSION=v1.0.0
  1. export CUSTOMIZE="true";curl -fsSL https://kubecube.nos-eastchina1.126.net/kubecube-installer/${KUBECUBE_VERSION}/entry.sh | bash

设置脚本参数,并按照提示继续运行安装脚本并等待新节点加入 control-plane

  • MASTER_IP 需要填已有的 master 节点 ip
  • LOCAL_IP 需要填新节点的节点 ip
  • CONTROL_PLANE_ENDPOINT 为高可用 vip
  1. # if install kubecube on pivot cluster
  2. INSTALL_KUBECUBE_PIVOT="false"
  3. # if install kubecube on member cluster
  4. INSTALL_KUBECUBE_MEMBER="false"
  5. # if install k8s
  6. INSTALL_KUBERNETES="true"
  7. # there are four node mode below:
  8. # "master" : node will be installed as a master of cluster
  9. # "node-join-master" : node will be install as a worker of cluster to join master
  10. # "control-plane-master" : node will be installed as a master to control plane of cluster
  11. # "node-join-control-plane" : node will be installed as a master to join control plane
  12. NODE_MODE="node-join-control-plane"
  13. # +optional
  14. # must be set when INSTALL_KUBECUBE_MEMBER="true"
  15. # this value is the name of member cluster you
  16. # want to take over
  17. MEMBER_CLUSTER_NAME=""
  18. # +optional
  19. # must be set when NODE_MODE="control-plane-master"
  20. # or "node-join-control-plane"
  21. CONTROL_PLANE_ENDPOINT="10.173.32.10" #{ip}:{port} , dns
  22. # master ip means master node ip of cluster
  23. MASTER_IP="10.173.32.4"
  24. # +optional
  25. # KUBECUBE_HOST must be set when as a member cluster to
  26. # join pivot cluster, the value is pivot node ip
  27. KUBECUBE_HOST=""
  28. # zone has two choice
  29. # 1. "cn" : in mainland
  30. # 2. "others" : out of mainland
  31. ZONE="cn"
  32. # k8s version you want to install
  33. KUBERNETES_VERSION="1.20.9"
  34. # +optional
  35. # the user who can access master node, it can be empty
  36. # when NODE_MODE="master" or "control-plane-master"
  37. MASTER_USER="root"
  38. # +optional
  39. # must be empty when ACCESS_PRIVATE_KEY_PATH set
  40. # password for master user to access master node
  41. ACCESS_PASSWORD=""
  42. # +optional
  43. # must be empty when ACCESS_PASSWORD set
  44. # ACCESS_PRIVATE_KEY for master user to access master node
  45. ACCESS_PRIVATE_KEY_PATH="/root/.ssh/id_rsa"

最后修改 August 19, 2021 : modify deploy doc (#25) (21772b2)