• 基于kubenetes的kubespere安装


    文档地址

    按文档步骤执行应该不会错

    https://v2-1.docs.kubesphere.io/docs/zh-CN/installation/prerequisites/

    安装helm

    下载

    版本1.17.3->helm-v2.6.12…,版本自己去文档找

    wget -O helm.tar.gz https://get.helm.sh/helm-v2.16.2-linux-amd64.tar.gz
    
    • 1

    解压和移动

    tar -zxvf helm-v2.16.2-linux-amd64.tar.gz
    
    • 1
    sudo mv linux-amd64/helm /usr/local/bin/helm
    
    • 1

    查看helm是否安装

    helm
    
    • 1

    创建 helm-rbac.yaml

    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: tiller
      namespace: kube-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: tiller
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: cluster-admin
    subjects: 
      - kind: ServiceAccount
        name: tiller
        namespace: kube-system
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18

    执行:

    kubectl apply -f helm_rbac.yaml
    
    • 1

    修改镜像

    helm repo list
    helm repo add stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
    
    • 1
    • 2

    执行:

    helm init --service-account=tiller --tiller-image=registry.cn-hangzhou.aliyuncs.com/google_containers/tiller:v2.16.3   --history-max 300
    
    • 1

    安装 OpenEBS 创建 LocalPV 存储类型

    前提条件(同样也参考文档,一步一步来)

    已有 Kubernetes 集群,并安装了 kubectl 或 Helm
    Pod 可以被调度到集群的 master 节点(可临时取消 master 节点的 Taint)

    查看节点

    kubectl get node -o wide
    
    • 1

    确认 master 节点是否有 Taint

    kubectl describe node master | grep Taint
    
    • 1

    去掉 master 节点的 Taint

    kubectl taint nodes master node-role.kubernetes.io/master:NoSchedule-
    
    • 1

    安装 OpenEBS

    kubectl create ns openebs
    
    • 1

    换镜像

    helm repo add stable http://mirror.azure.cn/kubernetes/charts
    
    • 1
    helm install --namespace openebs --name openebs stable/openebs --version 1.5.0
    
    • 1

    查看创建的 StorageClass

    kubectl get sc
    
    • 1

    设置为 默认的 StorageClass

    kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
    
    • 1

    master 节点 Taint 加上,避免业务相关的工作负载调度到 master 节点抢占 master 资源

    kubectl taint nodes master node-role.kubernetes.io/master=:NoSchedule
    
    • 1

    在 Kubernetes 安装 KubeSphere

    文档:

    https://v2-1.docs.kubesphere.io/docs/zh-CN/installation/install-on-k8s/

    最小化安装 KubeSphere

    不用官网的安装方式,连接已经失效了
    linux中新建

    vim kubesphere-minimal.yaml
    
    • 1

    将下面的复制进来,然后执行 kubectl apply -f kubesphere-minimal.yaml

    ---
    apiVersion: v1
    kind: Namespace
    metadata:
      name: kubesphere-system
    
    ---
    apiVersion: v1
    data:
      ks-config.yaml: |
        ---
        persistence:
          storageClass: ""
        etcd:
          monitoring: False
          endpointIps: 192.168.0.7,192.168.0.8,192.168.0.9
          port: 2379
          tlsEnable: True
        common:
          mysqlVolumeSize: 20Gi
          minioVolumeSize: 20Gi
          etcdVolumeSize: 20Gi
          openldapVolumeSize: 2Gi
          redisVolumSize: 2Gi
        metrics_server:
          enabled: False
        console:
          enableMultiLogin: False  # enable/disable multi login
          port: 30880
        monitoring:
          prometheusReplicas: 1
          prometheusMemoryRequest: 400Mi
          prometheusVolumeSize: 20Gi
          grafana:
            enabled: False
        logging:
          enabled: False
          elasticsearchMasterReplicas: 1
          elasticsearchDataReplicas: 1
          logsidecarReplicas: 2
          elasticsearchMasterVolumeSize: 4Gi
          elasticsearchDataVolumeSize: 20Gi
          logMaxAge: 7
          elkPrefix: logstash
          containersLogMountedPath: ""
          kibana:
            enabled: False
        openpitrix:
          enabled: False
        devops:
          enabled: False
          jenkinsMemoryLim: 2Gi
          jenkinsMemoryReq: 1500Mi
          jenkinsVolumeSize: 8Gi
          jenkinsJavaOpts_Xms: 512m
          jenkinsJavaOpts_Xmx: 512m
          jenkinsJavaOpts_MaxRAM: 2g
          sonarqube:
            enabled: False
            postgresqlVolumeSize: 8Gi
        servicemesh:
          enabled: False
        notification:
          enabled: False
        alerting:
          enabled: False
    kind: ConfigMap
    metadata:
      name: ks-installer
      namespace: kubesphere-system
    
    ---
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: ks-installer
      namespace: kubesphere-system
    
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      creationTimestamp: null
      name: ks-installer
    rules:
    - apiGroups:
      - ""
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - apps
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - extensions
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - batch
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - rbac.authorization.k8s.io
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - apiregistration.k8s.io
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - apiextensions.k8s.io
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - tenant.kubesphere.io
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - certificates.k8s.io
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - devops.kubesphere.io
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - monitoring.coreos.com
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - logging.kubesphere.io
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - jaegertracing.io
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - storage.k8s.io
      resources:
      - '*'
      verbs:
      - '*'
    - apiGroups:
      - admissionregistration.k8s.io
      resources:
      - '*'
      verbs:
      - '*'
    
    ---
    kind: ClusterRoleBinding
    apiVersion: rbac.authorization.k8s.io/v1
    metadata:
      name: ks-installer
    subjects:
    - kind: ServiceAccount
      name: ks-installer
      namespace: kubesphere-system
    roleRef:
      kind: ClusterRole
      name: ks-installer
      apiGroup: rbac.authorization.k8s.io
    
    ---
    apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: ks-installer
      namespace: kubesphere-system
      labels:
        app: ks-install
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: ks-install
      template:
        metadata:
          labels:
            app: ks-install
        spec:
          serviceAccountName: ks-installer
          containers:
          - name: installer
            image: kubesphere/ks-installer:v2.1.1
            imagePullPolicy: "Always"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213

    验证与访问

    查看滚动刷新的安装日志,请耐心等待安装成功

     kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
    
    • 1

    通过 kubectl get pod --all-namespaces查看 KubeSphere 相关 namespace 下所有 Pod 状态是否为 Running.

    确认 Pod 都正常运行后,可使用 IP:30880访问 KubeSphere UI 界面,默认的集群管理员账号为 admin/P@88w0rd。

  • 相关阅读:
    博客要写得好,Emoji要用对!
    飞书应用配置+蓝鲸流水线+jump server
    史上最强 Cocos Shader 学习资源推荐!(建议收藏)
    数据结构——带头双向循环链表
    【算法】【二叉树模块】求一个二叉树是否包含另一个二叉树的拓扑结构
    机器学习之信用卡欺诈识别(严重类失衡数据建模)
    INA 238 linux 驱动
    buuctf_练[羊城杯2020]easyphp
    SortedSet 和 List 异同点
    C++保留小数点后两位(floor&ceil&round)详解
  • 原文地址:https://blog.csdn.net/weixin_45031570/article/details/127813435