1. 官网2. 准备3. 安装3.1 下载KubeKey3.2 创建就请你配置文件3.3 创建集群3.4 安装对应文件报错报错一,版本问题报错二:Failed to download kube binaries3.4. 验证安装3.5 查看进度3.6 访问4. 卸载
1. 官网
2. 准备
准备三台服务器
- 4c8g (master)
- 8c16g * 2(worker)
- 内网互通
- 每个机器有自己域名
- 防火墙开放30000~32767端口
使用NFS记得提前配置,不过后续也可以。
我在Ubuntu挂载错误。
3. 安装
使用KubeKey创建集群
3.1 下载KubeKey
# 1.先执行以下命令以确保您从正确的区域下载 KubeKey。 export KKZONE=cn # 2.执行以下命令下载 KubeKey: curl -sfL https://get-kk.kubesphere.io | VERSION=v1.2.0 sh - # 3.为 kk 添加可执行权限: chmod +x kk
3.2 创建就请你配置文件
- 指定
kubernetes
、kubesphere
版本
- 目前Nov 25, 2021 ,KubeSphere3.2.0不支持v1.22.4
#./kk create config --with-kubernetes v1.22.4 --with-kubesphere v3.2.0 ./kk create config --with-kubernetes v1.21.5 --with-kubesphere v3.2.0
输入yes
3.3 创建集群
主节点运行
vim config-sample.yaml
config-sample.yaml
文件,修改以下参数- name
- address
- internalAddress
- user
- password
- etcd
- master
- worker
- version
apiVersion: kubekey.kubesphere.io/v1alpha1 kind: Cluster metadata: name: sample spec: hosts: - {name: master, address: 192.168.92.142, internalAddress: 192.168.92.142, user: root, password: root} - {name: node1, address: 192.168.92.143, internalAddress: 192.168.92.143, user: root, password: root} - {name: node2, address: 192.168.92.144, internalAddress: 192.168.92.144, user: root, password: root} roleGroups: etcd: - master master: - master worker: - node1 - node2 controlPlaneEndpoint: 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: [] --- apiVersion: installer.kubesphere.io/v1alpha1 kind: ClusterConfiguration metadata: name: ks-installer namespace: kubesphere-system labels: version: v3.2.0 spec: persistence: storageClass: "" authentication: jwtSecret: "" zone: "" local_registry: "" etcd: monitoring: true endpointIps: 192.168.92.142 port: 2379 tlsEnable: true common: redis: enabled: true redisVolumSize: 2Gi openldap: enabled: true openldapVolumeSize: 2Gi minioVolumeSize: 20Gi monitoring: endpoint: http://prometheus-operated.kubesphere-monitoring-system.svc:9090 es: elasticsearchMasterVolumeSize: 4Gi elasticsearchDataVolumeSize: 20Gi logMaxAge: 7 elkPrefix: logstash basicAuth: enabled: false username: "" password: "" externalElasticsearchUrl: "" externalElasticsearchPort: "" console: enableMultiLogin: true port: 30880 alerting: enabled: true # thanosruler: # replicas: 1 # resources: {} auditing: enabled: true devops: enabled: true jenkinsMemoryLim: 2Gi jenkinsMemoryReq: 1500Mi jenkinsVolumeSize: 8Gi jenkinsJavaOpts_Xms: 512m jenkinsJavaOpts_Xmx: 512m jenkinsJavaOpts_MaxRAM: 2g events: enabled: true ruler: enabled: true replicas: 2 logging: enabled: true logsidecar: enabled: true replicas: 2 metrics_server: enabled: false monitoring: storageClass: "" prometheusMemoryRequest: 400Mi prometheusVolumeSize: 20Gi multicluster: clusterRole: none network: networkpolicy: enabled: true ippool: type: calico topology: type: none openpitrix: store: enabled: true servicemesh: enabled: true kubeedge: enabled: true cloudCore: nodeSelector: {"node-role.kubernetes.io/worker": ""} tolerations: [] cloudhubPort: "10000" cloudhubQuicPort: "10001" cloudhubHttpsPort: "10002" cloudstreamPort: "10003" tunnelPort: "10004" cloudHub: advertiseAddress: - "" nodeLimit: "100" service: cloudhubNodePort: "30000" cloudhubQuicNodePort: "30001" cloudhubHttpsNodePort: "30002" cloudstreamNodePort: "30003" tunnelNodePort: "30004" edgeWatcher: nodeSelector: {"node-role.kubernetes.io/worker": ""} tolerations: [] edgeWatcherAgent: nodeSelector: {"node-role.kubernetes.io/worker": ""} tolerations: []
参数说明
修改
cluster-configuration.yaml
内容,用到那个功能将false
改为true
打开即可。- 监控功能
- 系统告诫功能
- devops功能
- 日志功能
- ippool:none—>calico
- kubeedge边缘计算
- redis功能
- 轻量级目录协议
- 审计功能
- 集群的事件功能
- 网络策略
- 应用商店
- 微服务治理功能
./kk create cluster -f config-sample.yaml
3.4 安装对应文件
三个节点安装
root@master:~# sudo apt-get install conntrack
创建,主节点运行
./kk create cluster -f config-sample.yaml
报错
报错一,版本问题
目前Nov 25, 2021 报错,不支持Kubenertes1.22.4
报错二:Failed to download kube binaries
原因分析:因为用kubekey安装后自己手动清理节点没清理干净,把你的节点清理一下,在Master、Node1、Node2执行以下命令后,重新安装即可。
[root@shiku183 opt]# ./kk delete cluster
参考:
3.4. 验证安装
安装完成后,您会看到如下内容:
4. 验证安装 安装完成后,您会看到如下内容: ##################################################### ### Welcome to KubeSphere! ### ##################################################### Console: http://192.168.92.142:30880 Account: admin Password: P@88w0rd NOTES: 1. After you log into the console, please check the monitoring status of service components in "Cluster Management". If any service is not ready, please wait patiently until all components are up and running. 2. Please change the default password after login. ##################################################### https://kubesphere.io 2021-11-25 19:06:26 ##################################################### INFO[19:06:30 CST] Installation is complete. Please check the result using the command: kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f root@master:~#
现在,您可以通过
<NodeIP:30880
使用默认帐户和密码 (admin/P@88w0rd
) 访问 KubeSphere 的 Web 控制台。3.5 查看进度
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
3.6 访问
Account: admin
Password: P@88w0rd
4. 卸载
如需删除集群,请执行以下命令。
- 如果是按照快速入门 (All-in-One) 安装的 KubeSphere:
./kk delete cluster
- 如果是使用高级模式安装的 KubeSphere(使用配置文件创建):
./kk delete cluster [-f config-sample.yaml]