下载:
curl -sfl https://get-kk.kubersphere.io | KKZONE=cn sh -
1.生成模板配置文件
./kk create config -f sample.yaml
2 .修改配置文件
apiVersion: kubekey.kubesphere.io/v1alpha1
kind: Cluster
metadata:
name: sample
spec:
hosts:
- {name: node1, address: 192.168.126.130, internalAddress: 192.168.126.130, user: root, password: root123}
- {name: node2, address: 192.168.126.131, internalAddress: 192.168.126.131, user: root, password: rooty123}
roleGroups:
etcd:
- node1 (指定存储节点)
master:
- node1 (指定主节点/控制面板)
worker:
- node1 (指定工作节点1)
- node2 (指定工作节点2)
controlPlaneEndpoint: (主节点/控制面板 有多个,需要负载均衡,两种模式,二选一)##Internal loadbalancer for apiservers (内部负载均衡)
#internalLoadbalancer: haproxy
domain: lb.kubesphere.local (外部负载均衡)
address: " "
port: 6443
kubernetes:
version: v1.21.5
imageRepo: kubesphere
clusterName: cluster.local
network:
plugin: calico
kubePodsCIDR: 10.233.64.0/18
kubeServiceCIDR: 10.233.0.0/18
registry:
registryMirrors: []
insecureRegistries: []
addons: []
3. 根据配置文件进行集群安装
./kk create cluster -f sample.yaml --with-kubesphere v【版本号】
4. 删除集群
./kk delete cluster -f sample.yaml