部署高可用KubeSphere

本文档基于CentOS7.6发行版最小化安装部署
1.安装依赖

yum -y install conntrack socat

2.下载kubekey

export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v1.2.1 sh -
chmod +x kk

3.生成配置文件

./kk create config # 默认生成kubernetes v1.21.5的示例配置,用于只安装kubernetes集群的场景
./kk create config --with-kubesphere v3.2.1 --with-kubernetes v1.21.5

4.自定义节点配置

spec:
  hosts:
  - {name: master01, address: 192.168.200.161, internalAddress: 192.168.200.161, user: root, password: "123456"}
  - {name: master02, address: 192.168.200.162, internalAddress: 192.168.200.162, user: root, password: "123456"}
  - {name: master03, address: 192.168.200.163, internalAddress: 192.168.200.163, user: root, password: "123456"}
  - {name: node01, address: 192.168.200.164, internalAddress: 192.168.200.164, user: root, password: "123456"}
  - {name: node02, address: 192.168.200.165, internalAddress: 192.168.200.165, user: root, password: "123456"}
  - {name: node03, address: 192.168.200.166, internalAddress: 192.168.200.166, user: root, password: "123456"}
  - {name: node04, address: 192.168.200.167, internalAddress: 192.168.200.167, user: root, password: "123456"}
  - {name: node05, address: 192.168.200.168, internalAddress: 192.168.200.168, user: root, password: "123456"}
  roleGroups:
    etcd:
    - master01
    - master02
    - master03
    master:
    - master01
    - master02
    - master03
    worker:
    - node01
    - node02
    - node03
    - node04
    - node05

5.开启内置或外置负载均衡(此处为内置)

spec:
  controlPlaneEndpoint:
    ##Internal loadbalancer for apiservers
    internalLoadbalancer: haproxy
    
    domain: lb.kubesphere.local
    address: ""
    port: 6443

6.创建或删除集群

./kk create cluster -f config-sample.yaml
./kk delete cluster -f config-sample.yaml

7.查看安装状态

kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

8.kubectl命令补全

yum install bash-completion -y
source /usr/share/bash-completion/bash_completion
kubectl completion bash > /etc/bash_completion.d/kubectl
source /etc/bash_completion.d/kubectl

官方文档:
https://kubesphere.io/zh/docs/installing-on-linux/

posted @ 2021-09-22 09:26  wanghongwei-dev  阅读(366)  评论(0编辑  收藏  举报