经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 数据库/运维 » Kubernetes » 查看文章
Kubernetes(K8S) kubesphere 安装
来源:cnblogs  作者:VipSoft  时间:2023/4/28 9:28:14  对本文有异议

安装KubeSphere最好的方法就是参考官方文档,而且官方文档是中文的。
官网地址:https://kubesphere.com.cn/

https://github.com/kubesphere/kubesphere/blob/master/README_zh.md
Kubernetes(K8S) kubesphere 介绍
安装提前条件:
使用 Kubeadm 部署 Kubernetes(K8S) 安装--附K8S架构图
使用 Kubeadm 部署 Kubernetes(K8S) 安装 -- 持久化存储(NFS网络存储)
Kubernetes(K8S) 安装 Metrics-Server

  1. # 检查 K8S 版本,低版本需要升级
  2. [root@k8smaster kubesphere]# kubectl version

image

安装

  1. [root@k8smaster ~]# cd /opt/k8s/kubesphere
  2. # 创建文件storageclass.yaml
  3. [root@k8smaster kubesphere]# vi storageclass.yaml
  4. kind: StorageClass
  5. apiVersion: storage.k8s.io/v1
  6. metadata:
  7. name: local-storage
  8. provisioner: kubernetes.io/no-provisioner
  9. volumeBindingMode: WaitForFirstConsumer
  10. # persistentVolumeClaim.yaml
  11. [root@k8smaster kubesphere]# vi persistentVolumeClaim.yaml
  12. apiVersion: v1
  13. kind: PersistentVolumeClaim
  14. metadata:
  15. name: local-pve
  16. spec:
  17. accessModes:
  18. - ReadWriteOnce
  19. resources:
  20. requests:
  21. storage: 20Gi
  22. storageClassName: local-storage
  23. # 下载核心文件(可以讯雷下载好传到 服务器)
  24. [root@k8smaster kubesphere]# wget https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/kubesphere-installer.yaml
  25. [root@k8smaster kubesphere]# wget https://github.com/kubesphere/ks-installer/releases/download/v3.1.1/cluster-configuration.yaml
  26. [root@k8smaster kubesphere]# ll
  27. 总用量 12
  28. -rwxrwxrwx 1 root root 7663 4 23 09:41 cluster-configuration.yaml
  29. -rwxrwxrwx 1 root root 4064 4 23 09:41 kubesphere-installer.yaml
  30. # 安装
  31. [root@k8smaster kubesphere]# kubectl apply -f storageclass.yaml
  32. storageclass.storage.k8s.io/local-storage created
  33. [root@k8smaster kubesphere]# kubectl apply -f persistentVolumeClaim.yaml
  34. persistentvolumeclaim/local-pve created
  35. [root@k8smaster kubesphere]# kubectl apply -f kubesphere-installer.yaml
  36. customresourcedefinition.apiextensions.k8s.io/clusterconfigurations.installer.kubesphere.io created
  37. namespace/kubesphere-system created
  38. serviceaccount/ks-installer created
  39. clusterrole.rbac.authorization.k8s.io/ks-installer created
  40. clusterrolebinding.rbac.authorization.k8s.io/ks-installer created
  41. deployment.apps/ks-installer created
  42. [root@k8smaster kubesphere]# kubectl apply -f cluster-configuration.yaml
  43. clusterconfiguration.installer.kubesphere.io/ks-installer created
  44. #解决找不到证书的问题
  45. [root@k8smaster kubesphere]# kubectl -n kubesphere-system create secret generic kube-etcd-client-certs --from-file=etcd-client-ca.crt=/etc/kubernetes/pki/etcd/ca.crt --from-file=etcd-client.crt=/etc/kubernetes/pki/apiserver-etcd-client.crt --from-file=etcd-client.key=/etc/kubernetes/pki/apiserver-etcd-client.key
  46. secret/kube-etcd-client-certs created
  47. # 查看 POD 详情
  48. [root@k8smaster kubesphere]# kubectl describe pod -n kubesphere-system
  49. Events:
  50. Type Reason Age From Message
  51. ---- ------ ---- ---- -------
  52. Normal Scheduled 12m default-scheduler Successfully assigned kubesphere-system/ks-installer-7bd6b699df-9lnlc to k8snode1
  53. Normal Pulling 12m kubelet Pulling image "kubesphere/ks-installer:v3.1.1"
  54. Normal Pulled 11m kubelet Successfully pulled image "kubesphere/ks-installer:v3.1.1"
  55. Normal Created 11m kubelet Created container installer
  56. Normal Started 11m kubelet Started container installer
  57. [root@k8smaster kubesphere]#
  58. # 使用命令查看进度
  59. [root@k8smaster kubesphere]# kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f

image

如果出现下面错误,需要安装 storageclass、persistentVolumeClaim

  1. TASK [preinstall : KubeSphere | Stopping if default StorageClass was not found] ***
  2. fatal: [localhost]: FAILED! => {
  3. "assertion": "\"(default)\" in default_storage_class_check.stdout",
  4. "changed": false,
  5. "evaluated_to": false,
  6. "msg": "Default StorageClass was not found !"
  7. }
  1. # 删除
  2. [root@k8smaster kubesphere]# kubectl delete -f kubesphere-installer.yaml
  3. [root@k8smaster kubesphere]# kubectl delete -f cluster-configuration.yaml
  4. # 安装完 storageclass 后,重新安装
  5. [root@k8smaster kubesphere]# kubectl apply -f storageclass.yaml
  6. [root@k8smaster kubesphere]# kubectl apply -f persistentVolumeClaim.yaml
  7. [root@k8smaster kubesphere]# kubectl apply -f kubesphere-installer.yaml
  8. [root@k8smaster kubesphere]# kubectl apply -f cluster-configuration.yaml

原文链接:https://www.cnblogs.com/vipsoft/p/17345593.html

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号