KubeSphere2.1踩坑记

Posted gmmy

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了KubeSphere2.1踩坑记相关的知识,希望对你有一定的参考价值。

至少两台机器。推荐4X16。(完全安装KubeSphere会吃掉10G+内存)

k8s安装(略1.14.8)可参考我上一篇文章或者基于kubeadmin快速安装

KubeSphere2.1前置条件

1.k8s版本必须小于1.6大于等于1.13 我选择的是1.14.8

2.helm必须大于等于2.10 小于2.16 我选择2.15.2

安装流程:

1.helm安装(master节点)

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

  tar zxvf helm-v2.15.2-linux-amd64.tar.gz

  cd liniux-amd64

  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/nfs *(insecure,rw,async,no_root_squash) 

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: 此处修改为nfs挂载地址
      volumes:
        - name: nfs-client
          nfs:
            server: 此处修改为nfs服务器ip
            path: 此处修改为nfs挂载地址
---
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

以上是关于KubeSphere2.1踩坑记的主要内容,如果未能解决你的问题,请参考以下文章

记一次 Spring 事务配置踩坑记

ViewPager实现无限轮播踩坑记

Linq多表查询 返回组合实体 踩坑记

踩坑记:根据类型获取Spring容器中的Bean

踩坑记:根据类型获取Spring容器中的Bean

centos 远程连接数据库踩坑记