一.增加集群节点

使用 KubeKey 检索集群信息。以下命令会创建配置文件:sample.yaml

./kk create config --from-cluster

 

二.配置文件修改和生成

将新节点的信息放在 hosts 和 roleGroups 之下。该示例添加了两个新节点(即 node1 和 node2)。这里的 master1 是现有节点。配置文件如下(红色部分为修改):

apiVersion: kubekey.kubesphere.io/v1alpha2

kind: Cluster

metadata:

name: sample

spec:

hosts:

##You should complete the ssh information of the hosts

- {name: k8s-master, address: x.x.x.2, internalAddress: x.x.x.2}

- {name: node1, address: x.x.x.3, internalAddress: x.x.x.3}

- {name: node2, address: x.x.x.4, internalAddress: x.x.x.4}

roleGroups:

etcd:

- k8s-master

master:

- k8s-master

worker:

- k8s-master

- node1

- node2

controlPlaneEndpoint:

##Internal loadbalancer for apiservers

#internalLoadbalancer: haproxy

##If the external loadbalancer was used, 'address' should be set to loadbalancer's ip.

domain: lb.kubesphere.local

address: ""

port: 6443

kubernetes:

version: v1.22.10

clusterName: cluster.local

proxyMode: ipvs

masqueradeAll: false

maxPods: 110

nodeCidrMaskSize: 24

network:

plugin: calico

kubePodsCIDR: 10.233.64.0/18

kubeServiceCIDR: 10.233.0.0/18

registry:

privateRegistry: ""

 三.扩容node节点:

 

./kk add nodes -f sample.yaml

 

四.扩容节点验证

您将能够在 KubeSphere 的控制台上查看新节点及其信息。在集群管理页面,选择左侧菜单节点下的集群节点,或者执行命令 kubectl get node 以检查更改。

 

 

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐