Kubernetes(K8S) kubesphere 安装

打印 上一主题 下一主题

主题 536|帖子 536|积分 1608

安装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
复制代码

安装
  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
复制代码

如果出现下面错误,需要安装 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
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

千千梦丶琪

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表