在四臺主機上部署(也可在虛擬機部署)

使用軟體版本
Centos7.9 內核3.10.0-1160.el7.x86_64
KubeSphere3.3
KubeSphere 官網 面向云原生應用的容器混合云,支持 Kubernetes 多集群管理的 PaaS 容器云平臺解決方案 | KubeSphere
四臺全新主機安裝Centos7.9 系統
阿里鏡像下載地址 http://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64
下載 CentOS-7-x86_64-DVD-2009.iso
U盤安裝Centos請參考 Rufus - 輕松創建USB啟動盤
系統安裝完畢,先進行系統設定
1) 系統設定
靜態IP設定
Centos7默認開機不啟動網卡,需要手動啟動 systemctl start network
使用命令 ip addr ,route -n 或 ifconfig 查看當前網路配置 ,然后再修改組態檔
vi /etc/sysconfig/network-scripts/ifcfg-exx 不同機器網卡名稱略微不同

重啟網卡 systemctl restart network
配置主機名
hostnamectl set-hostname xxx
修改host檔案
vim /etc/hosts
不要洗掉原來的內容
追加
192.168.10.222 node222
192.168.10.223 node223
192.168.10.224 node224
192.168.10.225 node225
關閉swap
vim /etc/fstab
注釋swap
關閉防火墻
systemctl status firewalld
關閉 SELinux
查看狀態 sestatus
修改 /etc/selinux/config
SELINUX=disabled
升級證書(不升級會出現證書過期問題)
yum upgrade ca-certificates
時間同步 yum install chrony -y
systemctl start chronyd
systemctl enable chronyd
vim /etc/chrony.conf
替換為阿里
server ntp.aliyun.com iburst
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst
2) 服務器免密配置
生成秘鑰
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa

想免密登錄誰,只需要把自己的公鑰傳遞給對方主機即可(自己對自己免密也要配置!)
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
要輸入對方root密碼
3) 安裝
安裝請參考官網檔案 多節點安裝 (kubesphere.com.cn)
所有服務器安裝
yum install socat
yum install sudo
yum install curl
yum install openssl
yum install tar
yum install ipset
yum install ebtables
yum install conntrack
所有服務器執行
export KKZONE=cn
主節點安裝kubekey
curl -sfL https://get-kk.kubesphere.io | VERSION=v2.2.1 sh -
chmod +x kk
創建組態檔
./kk create config --with-kubesphere version
修改組態檔
參考,我的是啟用了所有可插拔組件
apiVersion: kubekey.kubesphere.io/v1alpha2 kind: Cluster metadata: name: sample spec: hosts: - {name: node222, address: 192.168.10.222, internalAddress: 192.168.10.222, privateKeyPath: "~/.ssh/id_rsa"} - {name: node223, address: 192.168.10.223, internalAddress: 192.168.10.223, privateKeyPath: "~/.ssh/id_rsa"} - {name: node224, address: 192.168.10.224, internalAddress: 192.168.10.224, privateKeyPath: "~/.ssh/id_rsa"} - {name: node225, address: 192.168.10.225, internalAddress: 192.168.10.225, privateKeyPath: "~/.ssh/id_rsa"} roleGroups: etcd: - node222 control-plane: - node222 worker: - node222 - node223 - node224 - node225 controlPlaneEndpoint: ## Internal loadbalancer for apiservers # internalLoadbalancer: haproxydomain: lb.kubesphere.local address: "" port: 6443 kubernetes: version: --with-kubesphere clusterName: cluster.local autoRenewCerts: true containerManager: etcd: type: kubekey network: plugin: calico kubePodsCIDR: 10.233.64.0/18 kubeServiceCIDR: 10.233.0.0/18 ## multus support. https://github.com/k8snetworkplumbingwg/multus-cni multusCNI: enabled: false registry: privateRegistry: "" namespaceOverride: "" registryMirrors: ["https://whf4b9x8.mirror.aliyuncs.com"] insecureRegistries: [] addons: []
--- apiVersion: installer.kubesphere.io/v1alpha1 kind: ClusterConfiguration metadata: name: ks-installer namespace: kubesphere-system labels: version: v3.3.0 spec: persistence: storageClass: "" authentication: jwtSecret: "" zone: "" local_registry: "" namespace_override: "" # dev_tag: "" etcd: monitoring: false endpointIps: localhost port: 2379 tlsEnable: true common: core: console: enableMultiLogin: true port: 30880 type: NodePort # apiserver: # resources: {} # controllerManager: # resources: {} redis: enabled: true volumeSize: 2Gi openldap: enabled: false volumeSize: 2Gi minio: volumeSize: 20Gi monitoring: # type: external endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090 GPUMonitoring: enabled: false gpu: kinds: - resourceName: "nvidia.com/gpu" resourceType: "GPU" default: true es: # master: # volumeSize: 4Gi # replicas: 1 # resources: {} # data: # volumeSize: 20Gi # replicas: 1 # resources: {} logMaxAge: 7 elkPrefix: logstash basicAuth: enabled: false username: "" password: "" externalElasticsearchHost: "" externalElasticsearchPort: "" alerting: enabled: true # thanosruler: # replicas: 1 # resources: {} auditing: enabled: true # operator: # resources: {} # webhook: # resources: {} devops: enabled: true # resources: {} jenkinsMemoryLim: 2Gi jenkinsMemoryReq: 1500Mi jenkinsVolumeSize: 8Gi jenkinsJavaOpts_Xms: 1200m jenkinsJavaOpts_Xmx: 1600m jenkinsJavaOpts_MaxRAM: 2g events: enabled: true # operator: # resources: {} # exporter: # resources: {} # ruler: # enabled: true # replicas: 2 # resources: {} logging: enabled: true logsidecar: enabled: true replicas: 2 # resources: {} metrics_server: enabled: false monitoring: storageClass: "" node_exporter: port: 9100 # resources: {} # kube_rbac_proxy: # resources: {} # kube_state_metrics: # resources: {} # prometheus: # replicas: 1 # volumeSize: 20Gi # resources: {} # operator: # resources: {} # alertmanager: # replicas: 1 # resources: {} # notification_manager: # resources: {} # operator: # resources: {} # proxy: # resources: {} gpu: nvidia_dcgm_exporter: enabled: false # resources: {} multicluster: clusterRole: none network: networkpolicy: enabled: true ippool: type: none topology: type: weave-scope openpitrix: store: enabled: true servicemesh: enabled: true istio: components: ingressGateways: - name: istio-ingressgateway enabled: false cni: enabled: false edgeruntime: enabled: false kubeedge: enabled: false cloudCore: cloudHub: advertiseAddress: - "" service: cloudhubNodePort: "30000" cloudhubQuicNodePort: "30001" cloudhubHttpsNodePort: "30002" cloudstreamNodePort: "30003" tunnelNodePort: "30004" # resources: {} # hostNetWork: false iptables-manager: enabled: true mode: "external" # resources: {} # edgeService: # resources: {} terminal: timeout: 600
執行安裝命令
./kk create cluster -f config-sample.yaml
接下來是漫長的等待

4) 安裝問題
報錯
error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR SystemVerification]: unsupported graph driver: vfs [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...` To see the stack trace of this error execute with --v=5 or higher
設定docker存盤引擎
修改或創建 /etc/docker/daemon.json,并添加 "storage-driver": "overlay"
[root@localhost ~]# vim /etc/docker/daemon.json
{
"registry-mirrors": [],
"storage-driver": "overlay2"
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/502721.html
標籤:其他
