KubeSphere2.1踩坑記

至少兩臺機器。推薦4X16。(徹底安裝KubeSphere會吃掉10G+內存)html

k8s安裝(略1.14.8)可參考我上一篇文章或者基於kubeadmin快速安裝node

KubeSphere2.1前置條件linux

1.k8s版本必須小於1.6大於等於1.13 我選擇的是1.14.8git

2.helm必須大於等於2.10 小於2.16 我選擇2.15.2github

安裝流程:json

1.helm安裝(master節點)vim

  wget https://get.helm.sh/helm-v2.15.2-linux-amd64.tar.gzapi

  tar zxvf helm-v2.15.2-linux-amd64.tar.gz服務器

  cd liniux-amd64app

  mv helm /usr/local/bin

2.tiller安裝(master節點)

kubectl -n kube-system create serviceaccount tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller --skip-refresh --tiller-image registry.cn-shanghai.aliyuncs.com/rancher/tiller:v2.15.1

*驗證helm是否成功 輸入 helm list 沒有任何返回則表明成功

3. nfs安裝(安裝到node節點,master節點安裝後始終提示沒法鏈接,很詭異)

yum install -y nfs-utils

vim /etc/exports
/home/data node端ip/24(insecure,rw,async,no_root_squash) 

mkdir /home/data

chmod 777  /home/data

systemctl enable rpcbind.service
systemctl enable nfs-server.service
systemctl start rpcbind.service
systemctl start nfs-server.service

4.安裝storageclass(master節點)

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: nfs-provisioner
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
   name: nfs-provisioner-runner
   namespace: default
rules:
   -  apiGroups: [""]
      resources: ["persistentvolumes"]
      verbs: ["get", "list", "watch", "create", "delete"]
   -  apiGroups: [""]
      resources: ["persistentvolumeclaims"]
      verbs: ["get", "list", "watch", "update"]
   -  apiGroups: ["storage.k8s.io"]
      resources: ["storageclasses"]
      verbs: ["get", "list", "watch"]
   -  apiGroups: [""]
      resources: ["events"]
      verbs: ["watch", "create", "update", "patch"]
   -  apiGroups: [""]
      resources: ["services", "endpoints"]
      verbs: ["get","create","list", "watch","update"]
   -  apiGroups: ["extensions"]
      resources: ["podsecuritypolicies"]
      resourceNames: ["nfs-provisioner"]
      verbs: ["use"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: run-nfs-provisioner
subjects:
  - kind: ServiceAccount
    name: nfs-provisioner
    namespace: default
roleRef:
  kind: ClusterRole
  name: nfs-provisioner-runner
  apiGroup: rbac.authorization.k8s.io
---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: nfs-client-provisioner
spec:
  selector:
    matchLabels:
      app: nfs-client-provisioner
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: nfs-client-provisioner
    spec:
      serviceAccount: nfs-provisioner
      containers:
        - name: nfs-client-provisioner
          image: quay.io/external_storage/nfs-client-provisioner:latest
          imagePullPolicy: IfNotPresent
          volumeMounts:
            - name: nfs-client
              mountPath: /persistentvolumes
          env:
            - name: PROVISIONER_NAME
              value: fuseim.pri/ifs
            - name: NFS_SERVER
              value: 此處修改成nfs服務器ip
            - name: NFS_PATH
              value: /home/data
      volumes:
        - name: nfs-client
          nfs:
            server: 此處修改成nfs服務器ip
            path: /home/data
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: nfs-storage
provisioner: fuseim.pri/ifs
reclaimPolicy: Retain

  5.設置默認storageclass(master節點)

       kubectl patch storageclass nfs-storage -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

      

7.最小化安裝 KubeSphere(master節點)
kubectl apply -f https://raw.githubusercontent.com/kubesphere/ks-installer/master/kubesphere-minimal.yaml

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

相關文章
相關標籤/搜索