github地址:https://github.com/pixiake/ks-installer

官方使用文档:https://kubesphere.io/docs/advanced-v2.0/zh-CN/installation/all-in-one/

先放上安装效果图,UI界面还是很清爽的:

 

 

当前环境:

  • k8s集群已经安装完成,用kubesphere管理现有的k8s集群;

  • k8s版本为1.14

  • 系统为centos7.6

kubesphere使用要求:

  • kubernetes version > 1.13.0

  • helm version > 2.10.0

  • a default storage class must be in kubernetes cluster

安装完成后默认用户名密码:

  • 用户名:admin

  • 密码:P@88w0rd

 

安装步骤大概记录:

kubectl create ns kubesphere-system
kubectl create ns kubesphere-monitoring-system
#访问etcd用到的secret
kubectl -n kubesphere-monitoring-system create secret generic kube-etcd-client-certs  --from-file=etcd-client-ca.crt=ca.pem  --from-file=etcd-client.crt=etcd-key.pem  --from-file=etcd-client.key=etcd.pem
#管理k8s用到的secret
kubectl -n kubesphere-system create secret generic kubesphere-ca  --from-file=ca.crt=ca.pem --from-file=ca.key=ca-key.pem
#clone好github项目,执行下面的这条命令
cd deploy
kubectl apply -f kubesphere-installer.yaml
#执行完上面的命令,可以通过下面的命令,查看安装过程日志
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l job-name=kubesphere-installer -o jsonpath='{.items[0].metadata.name}') -f
#查看安装结果,STATUS跟下面保持一致才说明安装成功
[root@ks-allinone deploy]# kubectl get pods -n kubesphere-system
NAME                                     READY   STATUS      RESTARTS   AGE
ks-account-6db466d8dc-srrwj              1/1     Running     0          149m
ks-apigateway-7d77cb9495-jzmg6           1/1     Running     0          170m
ks-apiserver-f8469fd47-b58rm             1/1     Running     0          166m
ks-console-54c849bdc9-dfkbf              1/1     Running     0          168m
ks-console-54c849bdc9-z2d5q              1/1     Running     0          168m
ks-controller-manager-569456b4cd-gngm5   1/1     Running     0          170m
ks-docs-6bbdcc9bfb-6jldz                 1/1     Running     0          3h7m
kubesphere-installer-7ph6l               0/1     Completed   1          3h11m
openldap-5c986c5bff-rzqwv                1/1     Running     0          3h25m
redis-76dc4db5dd-lv6kg                   1/1     Running     0          149m
 

安装过程出现的错误:

1.在安装的时提示metrics-server已经安装,导致安装中断;

解析办法:在kubesphere-installer.yaml的configMap增加配置:metrics_server_enable: False(默认是没有的)

apiVersion: v1
data:
  ks-config.yaml: |
    kube_apiserver_host: 10.10.5.208:6443
    etcd_tls_enable: True
    etcd_endpoint_ips: 10.10.5.169,10.10.5.183,10.10.5.184
    disableMultiLogin: True
    elk_prefix: logstash
    metrics_server_enable: False
  #  local_registry: 192.168.1.2:5000
kind: ConfigMap
metadata:
  name: kubesphere-config
  namespace: kubesphere-system
 

增加Ingress配置:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kubesphere
  namespace: kubesphere-system
  annotations:
    #kubernetes.io/ingress.class: traefik
    kubernetes.io/ingress.class: nginx
spec:
  rules:
  - host: ks.staplescn.com
    http:
      paths:
      - path:
        backend:
          serviceName: ks-console
          servicePort: 80
 

访问界面: