KubeSphere®️ 是在目前主流容器调度平台 Kubernetes 之上构建的企业级分布式多租户容器管理平台,提供简单易用的操作界面以及向导式操作方式,在降低用户使用容器调度平台学习成本的同时,极大减轻开发、测试、运维的日常工作的复杂度,旨在解决 Kubernetes 本身存在的存储、网络、安全和易用性等痛点。除此之外,平台已经整合并优化了多个适用于容器场景的功能模块,以完整的解决方案帮助企业轻松应对敏捷开发与自动化运维、微服务治理、多租户管理、工作负载和集群管理、服务与网络管理、应用编排与管理、镜像仓库管理和存储管理等业务场景。
环境准备
本文安装KubeSphere使用到的相关工作环境具体如下:
系统版本 | 平台 | IP地址 | 角色 | 配置 |
---|---|---|---|---|
Centos7.4 | 阿里云 | 176.101.53.89 | allinnoe | CPU:16核对 内存:32GB 系统盘: 500G |
- KUBESPHERE版本 离线版2.02
安装KubeSphere
安装模式
KubeSphere 安装支持 all-in-one和 multi-node两种模式,即支持单节点和多节点安装两种安装方式。
- All-in-One模式(本文采取此模式)
All-in-One
模式即单节点安装,支持一键安装,仅建议用来测试或熟悉安装流程和了解 KubeSphere 高级版的功能特性,在正式使用环境建议使用 Multi-Node 模式。 - Multi-Node模式
Multi-Node 即多节点集群安装,高级版支持 master 节点和 etcd 的高可用,支持在正式环境安装和使用
安装包准备
curl -L https://kubesphere.io/download/offline/advanced-2.0.2 > advanced-2.0.2.tar.gz && tar -zxf advanced-2.0.2.tar.gz && cd kubesphere-all-offline-advanced-2.0.2/scripts
开始安装
KubeSphere 安装过程中将会自动化地进行环境和文件监测、平台依赖软件的安装、Kubernetes 和 etcd 的自动化安装,以及存储的自动化配置。最新的 Installer 默认安装的 Kubernetes 版本是 v1.13.5,安装成功后可通过 KubeSphere 控制台右上角点击关于查看安装的版本。
1.建议使用root用户进行安装,执行install.sh脚本
./install.sh
2.输入数字1选择第一种即all-in-one模式开始极速安装:
################################################
KubeSphere Installer Menu
################################################
* 1) All-in-one
* 2) Multi-node
* 3) Quit
################################################
https://kubesphere.io/ 2018-07-08
################################################
Please input an option: 1
3.等待开始安装,安装至第三个ansible-playbook时会有如下报错
TASK [ks-notification : ks-notification | Delete db-ctrl-job] ****************************************************************************************************************************************************************************************************************
Friday 23 August 2019 13:53:22 +0800 (0:00:01.397) 0:04:05.477 *********
TASK [ks-notification : ks-notification | Delete db-init-job] ****************************************************************************************************************************************************************************************************************
Friday 23 August 2019 13:53:23 +0800 (0:00:00.052) 0:04:05.529 *********
TASK [ks-notification : ks-notification | Init ks-notification] **************************************************************************************************************************************************************************************************************
Friday 23 August 2019 13:53:23 +0800 (0:00:00.064) 0:04:05.594 *********
changed: [ks-allinone]
TASK [ks-notification : ks-notification | Ctrl ks-notification] **************************************************************************************************************************************************************************************************************
Friday 23 August 2019 13:53:23 +0800 (0:00:00.544) 0:04:06.139 *********
changed: [ks-allinone]
TASK [ks-notification : ks-notification | Waiting for db-init-job] ***********************************************************************************************************************************************************************************************************
Friday 23 August 2019 13:53:24 +0800 (0:00:00.563) 0:04:06.702 *********
FAILED - RETRYING: ks-notification | Waiting for db-init-job (15 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (14 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (13 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (12 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (11 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (10 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (9 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (8 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (7 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (6 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (5 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (4 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (3 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (2 retries left).
FAILED - RETRYING: ks-notification | Waiting for db-init-job (1 retries left).
fatal: [ks-allinone]: FAILED! => {"attempts": 15, "changed": true, "cmd": "/usr/local/bin/kubectl -n kubesphere-alerting-system get pod | grep notification-db-init | awk '{print $3}'", "delta": "0:00:00.212257", "end": "2019-08-23 13:58:29.727183", "rc": 0, "start": "20
19-08-23 13:58:29.514926", "stderr": "", "stderr_lines": [], "stdout": "Init:0/1", "stdout_lines": ["Init:0/1"]}
PLAY RECAP *******************************************************************************************************************************************************************************************************************************************************************
ks-allinone : ok=261 changed=107 unreachable=0 failed=1
使用kubectl -n openpitrix-system get pod 查看相关POD状态
$ kubectl -n openpitrix-system get pod
NAME READY STATUS RESTARTS AGE
openpitrix-api-gateway-deployment-6879cc59c5-4zk2c 0/1 Init:0/2 2 66m
openpitrix-app-db-ctrl-job-5m9k8 0/1 Init:0/1 2 64m
openpitrix-app-manager-deployment-59b7469fb-txcz7 0/1 Init:0/2 2 66m
openpitrix-category-manager-deployment-77c5d84c67-pvccx 0/1 Init:0/2 2 66m
openpitrix-cluster-db-ctrl-job-2frk7 0/1 Init:0/1 2 64m
openpitrix-cluster-manager-deployment-5f4df977c5-zdfkl 0/1 Init:0/2 2 66m
openpitrix-db-deployment-78dff6d6cc-w6xlb 1/1 Running 2 66m
openpitrix-db-init-job-jlh2t 0/1 Init:0/1 2 64m
openpitrix-etcd-deployment-6796648dfb-rgd54 1/1 Running 2 66m
openpitrix-iam-db-ctrl-job-r99m5 0/1 Init:0/1 2 64m
openpitrix-iam-service-deployment-795984cf6-qvbzs 0/1 Init:0/2 2 66m
openpitrix-job-db-ctrl-job-qrp4c 0/1 Init:0/1 2 64m
openpitrix-job-manager-deployment-577d4947d8-7zb4b 0/1 Init:0/2 2 66m
openpitrix-minio-deployment-77d9d557bf-cdn2v 1/1 Running 2 66m
openpitrix-repo-db-ctrl-job-vxwqf 0/1 Init:0/1 2 64m
openpitrix-repo-indexer-deployment-c96fd8545-cnklr 0/1 Init:0/2 2 66m
openpitrix-repo-manager-deployment-fc8b866d6-pq9bq 0/1 Init:0/2 2 66m
openpitrix-runtime-db-ctrl-job-cjbls 0/1 Init:0/1 2 64m
openpitrix-runtime-manager-deployment-6865cb974b-wbwxg 0/1 Init:0/2 2 66m
openpitrix-task-db-ctrl-job-5qsj2 0/1 Init:0/1 2 64m
openpitrix-task-manager-deployment-5d55bd8849-plxqb 0/1 Init:0/2 2 66m
查看/etc/resolv.conf
nameserver 176.101.52.2
删除该记录,并删除命名空间中kube-system中的coredns.pod删除后,会重新建立。
[root@ks-allinone ~]# kubectl delete pod coredns-59647c5bf6-m2lf2 -n kube-system
pod "coredns-59647c5bf6-m2lf2" deleted
重新查看命名空间下的openpitrix-system下的pod状态
$ kubectl -n openpitrix-system get pod
NAME READY STATUS RESTARTS AGE
op
enpitrix-api-gateway-deployment-6879cc59c5-4zk2c 0/1 Init:0/2 2 66m
openpitrix-app-db-ctrl-job-5m9k8 0/1 Init:0/1 2 64m
openpitrix-app-manager-deployment-59b7469fb-txcz7 0/1 Init:0/2 2 66m
openpitrix-category-manager-deployment-77c5d84c67-pvccx 0/1 Init:0/2 2 66m
openpitrix-cluster-db-ctrl-job-2frk7 0/1 Init:0/1 2 64m
openpitrix-cluster-manager-deployment-5f4df977c5-zdfkl 0/1 Init:0/2 2 66m
openpitrix-db-deployment-78dff6d6cc-w6xlb 1/1 Running 2 66m
openpitrix-db-init-job-jlh2t 0/1 Init:0/1 2 64m
openpitrix-etcd-deployment-6796648dfb-rgd54 1/1 Running 2 66m
openpitrix-iam-db-ctrl-job-r99m5 0/1 Init:0/1 2 64m
openpitrix-iam-service-deployment-795984cf6-qvbzs 0/1 Init:0/2 2 66m
openpitrix-job-db-ctrl-job-qrp4c 0/1 Init:0/1 2 64m
openpitrix-job-manager-deployment-577d4947d8-7zb4b 0/1 Init:0/2 2 66m
openpitrix-minio-deployment-77d9d557bf-cdn2v 1/1 Running 2 66m
openpitrix-repo-db-ctrl-job-vxwqf 0/1 Init:0/1 2 64m
openpitrix-repo-indexer-deployment-c96fd8545-cnklr 0/1 Init:0/2 2 66m
openpitrix-repo-manager-deployment-fc8b866d6-pq9bq 0/1 Init:0/2 2 66m
openpitrix-runtime-db-ctrl-job-cjbls 0/1 Init:0/1 2 64m
openpitrix-runtime-manager-deployment-6865cb974b-wbwxg 0/1 Init:0/2 2 66m
openpitrix-task-db-ctrl-job-5qsj2 0/1 Init:0/1 2 64m
openpitrix-task-manager-deployment-5d55bd8849-plxqb 0/1 Init:0/2 2 66m
发现依旧处于该状态,故执行下列命令
kubectl -n kube-system edit cm coredns
删除upstream和proxy那两行,然后执行下列命令
kubectl -n kube-system scale deploy coredns --replicas=0 && kubectl -n kube-system scale deploy coredns --replicas=1
deployment.extensions/cdoredns scaled
deployment.extensions/coredns scaled
此时再次查看命名空间下的openpitrix-system下的pod状态
[root@ks-allinone ~]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
openpitrix-api-gateway-deployment-6879cc59c5-4zk2c 1/1 Running 0 81m
openpitrix-app-db-ctrl-job-5m9k8 0/1 Completed 0 79m
openpitrix-app-manager-deployment-59b7469fb-txcz7 1/1 Running 0 81m
openpitrix-category-manager-deployment-77c5d84c67-pvccx 1/1 Running 0 81m
openpitrix-cluster-db-ctrl-job-2frk7 0/1 Completed 0 79m
openpitrix-cluster-manager-deployment-5f4df977c5-zdfkl 1/1 Running 0 81m
openpitrix-db-deployment-78dff6d6cc-w6xlb 1/1 Running 2 81m
openpitrix-db-init-job-jlh2t 0/1 Completed 0 79m
openpitrix-etcd-deployment-6796648dfb-rgd54 1/1 Running 2 81m
openpitrix-iam-db-ctrl-job-r99m5 0/1 Completed 0 79m
openpitrix-iam-service-deployment-795984cf6-qvbzs 1/1 Running 0 81m
openpitrix-job-db-ctrl-job-qrp4c 0/1 Completed 0 79m
openpitrix-job-manager-deployment-577d4947d8-7zb4b 1/1 Running 0 81m
openpitrix-minio-deployment-77d9d557bf-cdn2v 1/1 Running 2 81m
openpitrix-repo-db-ctrl-job-vxwqf 0/1 Completed 0 79m
openpitrix-repo-indexer-deployment-c96fd8545-cnklr 1/1 Running 0 81m
openpitrix-repo-manager-deployment-fc8b866d6-pq9bq 1/1 Running 0 81m
openpitrix-runtime-db-ctrl-job-cjbls 0/1 Completed 0 79m
openpitrix-runtime-manager-deployment-6865cb974b-wbwxg 1/1 Running 0 81m
openpitrix-task-db-ctrl-job-5qsj2 0/1 Completed 0 79m
openpitrix-task-manager-deployment-5d55bd8849-plxqb 1/1 Running 0 81m
状态正常后,修改./scripts下的allinone.sh脚本里的前二个ansible-playbook 命令注释掉,直接执行这个脚本。等待安装完成。安装完成后,如下所示
ks-notification : ks-notification | Waiting for db-init-job ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 20.78s
ks-monitor : ks-monitor | Getting monitor installation files --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 12.00s
openpitrix : OpenPitrix | Getting OpenPitrix installation files ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 10.50s
storages/LocalVolume : local_volume | Creating manifests -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 8.75s
prepare/base : KubeSphere | Create kubesphere namespace --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 5.33s
openpitrix : OpenPitrix | Installing OpenPitrix(2) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4.49s
ks-devops/ks-devops : OpenPitrix | Installing OpenPitrix(3) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4.38s
metrics-server : Metrics-Server | Getting metrics-server installation files ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 4.09s
ks-devops/jenkins : ks-devops | Waiting for ks-sonarqube -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.71s
prepare/nodes : GlusterFS | Installing glusterfs-client (YUM) --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.60s
ks-devops/jenkins : ks-devops | Waitting for ks-sonarqube port to become open ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.49s
prepare/base : KubeSphere | Labeling system-workspace ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.40s
storages/LocalVolume : local_volume | Creating directories for local_volume ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 3.23s
ks-logging : ks-logging | Creating manifests -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.98s
prepare/base : KubeSphere | Getting installation init files ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.91s
ks-devops/s2i : S2I | Deploy S2I template&&operator ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.89s
ks-monitor : ks-monitor | Creating manifests -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.87s
ks-notification : ks-notification | Creating manifests ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.42s
ks-devops/jenkins : ks-devops | Getting jenkins installation files ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 2.15s
prepare/base : KubeSphere | Creating manifests ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ 2.07s
successsful!
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://176.101.53.89:30880
Account: admin
Password: P@88w0rd
NOTE:
1. After log in to console, please verify the
monitoring status of service components in
the "Cluster Status". If the service is not
ready, please wait patiently. You can start
to use when all components are totally ready.
2. Please modify the default password after login.
#####################################################
此时用浏览器访问上面地址即可页面如下所示 使用admin/P@88w0rd登录
image.pngimage.png
image.png image.png
具体平台使用方法可跳转至https://kubesphere.io进行相关阅读查询
网友评论