k8s集群安装KubeSphere3.0

架构:

k8s集群安装KubeSphere3.0_第1张图片

前提条件:
k8s集群版本必须是1.15.x, 1.16.x, 1.17.x, or 1.18.x
必须有默认的storageclass
内存和cpu最低要求:CPU > 1 Core, Memory > 2 G

安装并设置默认storageclass略过,可以看之前的我发过的博客https://www.cnblogs.com/lfl17718347843/p/14131062.html

1.安装yaml文件 (先安装第一个,再安装第二个)

kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/kubesphere-installer.yaml
   
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.0.0/cluster-configuration.yaml

2.查看安装日志 (其实不看日志也行,只要所有pod都是running状态就行,如果网络慢,可能就慢点。)

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

3.查看所有pod

kubectl get pods -A
NAMESPACE                      NAME                                               READY   STATUS    RESTARTS   AGE
default                        nfs-client-provisioner-6d4469b5b5-bh6t9            1/1     Running   0          31m
kube-system                    coredns-66bff467f8-rkb9n                           1/1     Running   0          73m
kube-system                    coredns-66bff467f8-rtbnt                           1/1     Running   0          73m
kube-system                    etcd-master1                                       1/1     Running   0          74m
kube-system                    etcd-master2                                       1/1     Running   0          66m
kube-system                    etcd-master3                                       1/1     Running   0          65m
kube-system                    kube-apiserver-master1                             1/1     Running   0          74m
kube-system                    kube-apiserver-master2                             1/1     Running   0          67m
kube-system                    kube-apiserver-master3                             1/1     Running   1          64m
kube-system                    kube-controller-manager-master1                    1/1     Running   1          74m
kube-system                    kube-controller-manager-master2                    1/1     Running   0          67m
kube-system                    kube-controller-manager-master3                    1/1     Running   0          65m
kube-system                    kube-flannel-ds-6hnzh                              1/1     Running   0          64m
kube-system                    kube-flannel-ds-88kl4                              1/1     Running   0          64m
kube-system                    kube-flannel-ds-p79jk                              1/1     Running   0          64m
kube-system                    kube-flannel-ds-vkbjw                              1/1     Running   0          64m
kube-system                    kube-proxy-9bjb5                                   1/1     Running   0          73m
kube-system                    kube-proxy-9smdl                                   1/1     Running   0          67m
kube-system                    kube-proxy-hdgrp                                   1/1     Running   0          66m
kube-system                    kube-proxy-vxm96                                   1/1     Running   0          65m
kube-system                    kube-scheduler-master1                             1/1     Running   1          74m
kube-system                    kube-scheduler-master2                             1/1     Running   0          67m
kube-system                    kube-scheduler-master3                             1/1     Running   0          65m
kube-system                    snapshot-controller-0                              1/1     Running   0          18m
kubesphere-controls-system     default-http-backend-857d7b6856-jpdfk              1/1     Running   0          18m
kubesphere-controls-system     kubectl-admin-58f985d8f6-b6v8d                     1/1     Running   0          10m
kubesphere-monitoring-system   alertmanager-main-0                                2/2     Running   0          15m
kubesphere-monitoring-system   alertmanager-main-1                                2/2     Running   0          15m
kubesphere-monitoring-system   alertmanager-main-2                                2/2     Running   0          15m
kubesphere-monitoring-system   kube-state-metrics-95c974544-qxvmn                 3/3     Running   0          16m
kubesphere-monitoring-system   node-exporter-6rsh2                                2/2     Running   0          16m
kubesphere-monitoring-system   node-exporter-fzccb                                2/2     Running   0          16m
kubesphere-monitoring-system   node-exporter-jjw99                                2/2     Running   0          16m
kubesphere-monitoring-system   node-exporter-lnk9f                                2/2     Running   0          16m
kubesphere-monitoring-system   notification-manager-deployment-7c8df68d94-r2rrf   1/1     Running   0          3m57s
kubesphere-monitoring-system   notification-manager-deployment-7c8df68d94-wzv5h   1/1     Running   0          3m57s
kubesphere-monitoring-system   notification-manager-operator-6958786cd6-msgn7     2/2     Running   0          16m
kubesphere-monitoring-system   prometheus-k8s-0                                   3/3     Running   1          15m
kubesphere-monitoring-system   prometheus-k8s-1                                   0/3     Pending   0          15m
kubesphere-monitoring-system   prometheus-operator-84d58bf775-q7h5h               2/2     Running   0          16m
kubesphere-system              ks-apiserver-7769cf4cd9-95rwh                      1/1     Running   0          9m32s
kubesphere-system              ks-apiserver-7769cf4cd9-v5k6q                      1/1     Running   0          13m
kubesphere-system              ks-apiserver-7769cf4cd9-zpnk2                      1/1     Running   0          16m
kubesphere-system              ks-console-786b9846d4-6g6rm                        1/1     Running   0          17m
kubesphere-system              ks-console-786b9846d4-ctqqc                        1/1     Running   0          17m
kubesphere-system              ks-console-786b9846d4-grrcx                        1/1     Running   0          17m
kubesphere-system              ks-controller-manager-7b4b88b75-2lhv4              1/1     Running   0          16m
kubesphere-system              ks-controller-manager-7b4b88b75-7h57t              1/1     Running   0          8m50s
kubesphere-system              ks-controller-manager-7b4b88b75-xncc9              1/1     Running   0          4m26s
kubesphere-system              ks-installer-7cb866bd-c9v9t                        1/1     Running   0          19m
kubesphere-system              openldap-0                                         1/1     Running   0          18m
kubesphere-system              openldap-1                                         1/1     Running   0          11m
kubesphere-system              redis-ha-haproxy-5c6559d588-78xlz                  1/1     Running   4          18m
kubesphere-system              redis-ha-haproxy-5c6559d588-qcrtf                  1/1     Running   4          18m
kubesphere-system              redis-ha-haproxy-5c6559d588-vxhkg                  1/1     Running   5          18m
kubesphere-system              redis-ha-server-0                                  2/2     Running   0          18m
kubesphere-system              redis-ha-server-1                                  2/2     Running   0          14m
kubesphere-system              redis-ha-server-2                                  2/2     Running   0          10m

4.登陆kubesphere
ip:30880
用户名:admin
默认密码:P@88w0rd

k8s集群安装KubeSphere3.0_第2张图片

5、如果提示account is not active执行下面命令即可解决问题

k8s集群安装KubeSphere3.0_第3张图片
kubectl apply -f https://raw.githubusercontent.com/kubesphere/ks-installer/2c4b479ec65110f7910f913734b3d069409d72a8/roles/ks-core/prepare/files/ks-init/users.iam.kubesphere.io.yaml

kubectl apply -f https://raw.githubusercontent.com/kubesphere/ks-installer/2c4b479ec65110f7910f913734b3d069409d72a8/roles/ks-core/prepare/files/ks-init/webhook-secret.yaml

kubectl -n kubesphere-system rollout restart deploy ks-controller-manager

详解:
1、kubesphere 安装完成后会创建默认账户admin/P@88w0rd,待ks-controller-manager启动就绪,user controller 会将 user CRD中定义的password加密,user会被转换为active状态,至此账户才可以正常登录。

2、当安装完成后遇到默认账户无法登录,看到account is not active相关错误提示时,需要检查ks-controller-manager的运行状态和日志。

存储、网络问题:
1、user controller 依赖的外部服务有openldap和jenkins,在依赖服务不正常的情况下controller会一直reconcile,user CRD状态无法正常维护,导致账户无法登录。

2、可以通过 ks-controller-manager 日志和查询pod运行状态查找问题。

经常出现的错误:存储配置错误、数据丢失、集群网络不通。

你可能感兴趣的:(linux,数据库,mysql,java,python)