当前位置: 首页 > 工具软件 > KubeSphere > 使用案例 >

在 Linux 上以 All-in-One 模式安装 KubeSphere

夏侯阳
2023-12-01

前言

最近部门内需要进行私有化部署,所以这个系列主要是以docker+Kubernetes 技术选型和的调研为主了。
很久没有更新博客,这里把自己的随笔记录到博客中,后续再进行详细整理吧

一、在 Linux 上以 All-in-One 模式安装 KubeSphere

为什么不纯手动安全k8s呢?

首先我们是想选购一个成型的标准封装尽量简化我们的安装流程。
其次我们如果实现这个标品是ok的那么,其实就获得了它的离线安装能力。

当然也有一些缺点,我们不清楚内部构造,重启服务遇到问题时,我们也无法进行问题解决,所以我感觉先试用这个服务后续还要进行一把纯手动安装这样要清楚的知道哪部分出了啥问题。

安装步骤

前置准备

我是用mac电脑安装的vmware进行的操作,因为它只能支持linux下的操作环境。然后你需要下载centos7的镜像,然后把你的虚拟机安装才行。

实际安装

参照网址安装:
https://kubesphere.com.cn/docs/quick-start/all-in-one-on-linux/

安装步骤如下:

#需要先下个叫kk的小东西
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v2.0.0 sh -
#开始安装,设置版本号
./kk create cluster --with-kubernetes v1.21.5 --with-kubesphere v3.2.1
#然后大体操作流程就是它会从各种数据源中获取到镜像文件
downloading amd64 kubelet v1.21.5 ...
21:56:43 PDT message: [localhost]
#执行安装这些镜像和install的镜像
21:59:53 PDT [InstallETCDBinaryModule] Install etcd using binary
21:59:54 PDT success: [localhost.localdomain.cluster.local]
#最后会卡到这里,最后那个点就是菊花了,一直等它转完就ok了
#这里的速度取决于机器配置了,2CPU 4G内存,至少半小时。
clusterconfiguration.installer.kubesphere.io/ks-installer created
22:00:43 PDT success: [localhost.localdomain.cluster.local]
Please wait for the installation to complete:  >>--->
#安装完毕是这个界面:
#####################################################
###              Welcome to KubeSphere!           ###
#####################################################

Console: http://192.168.3.64:30880
Account: admin
Password: P@88w0rd

NOTES:
  1. After you log into the console, please check the
     monitoring status of service components in
     "Cluster Management". If any service is not
     ready, please wait patiently until all components
     are up and running.
  2. Please change the default password after login.

#####################################################
https://kubesphere.io             2022-06-02 22:14:25
#####################################################
22:14:29 PDT success: [localhost.localdomain.cluster.local]
22:14:29 PDT Pipeline[CreateClusterPipeline] execute successful
Installation is complete.

Please check the result using the command:

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

记录一下当前机器的images和ps容器,方便后续排查问题。真是感觉后续可能有问题不好排查,因为k8s的文档才是最全的。

[root@localhost ~]# docker images
REPOSITORY                                                              TAG       IMAGE ID       CREATED         SIZE
kubesphere/ks-installer                                                 v3.2.1    7f833c28ad87   5 months ago    383MB
kubesphere/ks-controller-manager                                        v3.2.1    ea90d211235f   5 months ago    168MB
kubesphere/ks-apiserver                                                 v3.2.1    be3514bdedbc   5 months ago    191MB
kubesphere/ks-console                                                   v3.2.1    d7026f326408   5 months ago    112MB
kubesphere/kubectl                                                      v1.21.0   f1e3bb4ed882   7 months ago    79MB
kubesphere/notification-manager                                         v1.4.0    b8b2f6b3790f   7 months ago    51.8MB
kubesphere/notification-tenant-sidecar                                  v3.2.0    4b47c43ec6ab   8 months ago    52.8MB
kubesphere/notification-manager-operator                                v1.4.0    08ca8def2520   8 months ago    46.2MB
kubesphere/kube-apiserver                                               v1.21.5   7b2ac941d4c3   8 months ago    126MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-apiserver            v1.21.5   7b2ac941d4c3   8 months ago    126MB
kubesphere/kube-proxy                                                   v1.21.5   e08abd2be730   8 months ago    104MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-proxy                v1.21.5   e08abd2be730   8 months ago    104MB
kubesphere/kube-controller-manager                                      v1.21.5   184ef4d127b4   8 months ago    120MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-controller-manager   v1.21.5   184ef4d127b4   8 months ago    120MB
kubesphere/kube-scheduler                                               v1.21.5   8e60ea3644d6   8 months ago    50.8MB
registry.cn-beijing.aliyuncs.com/kubesphereio/kube-scheduler            v1.21.5   8e60ea3644d6   8 months ago    50.8MB
calico/node                                                             v3.20.0   5ef66b403f4f   10 months ago   170MB
calico/pod2daemon-flexvol                                               v3.20.0   5991877ebc11   10 months ago   21.7MB
calico/cni                                                              v3.20.0   4945b742b8e6   10 months ago   146MB
calico/kube-controllers                                                 v3.20.0   76ba70f4748f   10 months ago   63.2MB
openebs/provisioner-localpv                                             2.10.1    b5e01d57c971   11 months ago   62.7MB
kubesphere/pause                                                        3.4.1     0f8457a4c2ec   16 months ago   683kB
registry.cn-beijing.aliyuncs.com/kubesphereio/pause                     3.4.1     0f8457a4c2ec   16 months ago   683kB
csiplugin/snapshot-controller                                           v4.0.0    f1d8a00ae690   17 months ago   46.6MB
kubesphere/prometheus-config-reloader                                   v0.43.2   08ed6bfd22b5   19 months ago   13.4MB
kubesphere/prometheus-operator                                          v0.43.2   4ad0a8e16901   19 months ago   41.9MB
kubesphere/kube-rbac-proxy                                              v0.8.0    ad393d6a4d1b   19 months ago   49MB
coredns/coredns                                                         1.8.0     296a6d5035e2   19 months ago   42.5MB
registry.cn-beijing.aliyuncs.com/kubesphereio/coredns                   1.8.0     296a6d5035e2   19 months ago   42.5MB
prom/alertmanager                                                       v0.21.0   c876f5897d7b   23 months ago   55.5MB
kubesphere/kube-state-metrics                                           v1.9.7    6497f02dbdad   24 months ago   32.8MB
kubesphere/k8s-dns-node-cache                                           1.15.12   5340ba194ec9   2 years ago     107MB
prom/node-exporter                                                      v0.18.1   e5a616e4b9cf   2 years ago     22.9MB
mirrorgooglecontainers/defaultbackend-amd64                             1.4       846921f0fe0e   4 years ago     4.84MB

[root@localhost ~]# docker ps
CONTAINER ID   IMAGE                                         COMMAND                  CREATED          STATUS          PORTS     NAMES
7182bd2263bc   kubesphere/kubectl                            "entrypoint.sh"          2 minutes ago    Up 2 minutes              k8s_kubectl_kubectl-admin-6667774bb-8hdbr_kubesphere-controls-system_71f76418-3d48-4f0a-bc24-39c0ddfcdd8b_0
e5f7d753fc8b   kubesphere/pause:3.4.1                        "/pause"                 3 minutes ago    Up 3 minutes              k8s_POD_kubectl-admin-6667774bb-8hdbr_kubesphere-controls-system_71f76418-3d48-4f0a-bc24-39c0ddfcdd8b_0
c404189a1b3f   kubesphere/ks-controller-manager              "controller-manager …"   3 minutes ago    Up 3 minutes              k8s_ks-controller-manager_ks-controller-manager-6bdbc4d56-qgqc8_kubesphere-system_a5813eaa-f457-4500-91a6-81c23711db2e_0
7a10ca1c5d6d   kubesphere/ks-apiserver                       "ks-apiserver --logt…"   3 minutes ago    Up 3 minutes              k8s_ks-apiserver_ks-apiserver-8484959456-k5fqx_kubesphere-system_759c72b1-36c5-46b5-9cfa-2dd2ddd86bfd_0
9d7af515835e   kubesphere/pause:3.4.1                        "/pause"                 3 minutes ago    Up 3 minutes              k8s_POD_ks-controller-manager-6bdbc4d56-qgqc8_kubesphere-system_a5813eaa-f457-4500-91a6-81c23711db2e_0
06a75444266b   kubesphere/pause:3.4.1                        "/pause"                 3 minutes ago    Up 3 minutes              k8s_POD_ks-apiserver-8484959456-k5fqx_kubesphere-system_759c72b1-36c5-46b5-9cfa-2dd2ddd86bfd_0
f29dc368c6f3   kubesphere/notification-tenant-sidecar        "/tenant-sidecar"        4 minutes ago    Up 4 minutes              k8s_tenant_notification-manager-deployment-78664576cb-k4xkt_kubesphere-monitoring-system_17e94aa1-150f-44e4-958d-6706e3db83a9_0
70dc8d507884   kubesphere/notification-manager               "/notification-manag…"   4 minutes ago    Up 4 minutes              k8s_notification-manager_notification-manager-deployment-78664576cb-k4xkt_kubesphere-monitoring-system_17e94aa1-150f-44e4-958d-6706e3db83a9_0
1f30e708aa3f   kubesphere/pause:3.4.1                        "/pause"                 4 minutes ago    Up 4 minutes              k8s_POD_notification-manager-deployment-78664576cb-k4xkt_kubesphere-monitoring-system_17e94aa1-150f-44e4-958d-6706e3db83a9_0
15c9d9c549a2   kubesphere/notification-manager-operator      "/notification-manag…"   5 minutes ago    Up 5 minutes              k8s_notification-manager-operator_notification-manager-operator-7d44854f54-lmvt8_kubesphere-monitoring-system_abf70a62-f110-492c-983c-174230dbe354_0
d56a4d6b30fb   kubesphere/prometheus-config-reloader         "/bin/prometheus-con…"   5 minutes ago    Up 5 minutes              k8s_config-reloader_alertmanager-main-0_kubesphere-monitoring-system_d4d538de-a7fc-4990-92bb-67a05e8b5fb3_0
8d5dd9365770   ad393d6a4d1b                                  "/usr/local/bin/kube…"   5 minutes ago    Up 5 minutes              k8s_kube-rbac-proxy-self_kube-state-metrics-5547ddd4cc-8gmzt_kubesphere-monitoring-system_72c5e270-8c12-4b7e-be8a-a67007147841_0
e1ffb874c1c1   kubesphere/kube-rbac-proxy                    "/usr/local/bin/kube…"   5 minutes ago    Up 5 minutes              k8s_kube-rbac-proxy-main_kube-state-metrics-5547ddd4cc-8gmzt_kubesphere-monitoring-system_72c5e270-8c12-4b7e-be8a-a67007147841_0
e18fcadb2e05   kubesphere/kube-rbac-proxy                    "/usr/local/bin/kube…"   5 minutes ago    Up 5 minutes              k8s_kube-rbac-proxy_node-exporter-px22q_kubesphere-monitoring-system_5770efd5-7df5-4b40-b9d0-fd1f67abf0a4_0
06513567f672   ad393d6a4d1b                                  "/usr/local/bin/kube…"   5 minutes ago    Up 5 minutes              k8s_kube-rbac-proxy_notification-manager-operator-7d44854f54-lmvt8_kubesphere-monitoring-system_abf70a62-f110-492c-983c-174230dbe354_0
18fcbbb9c4e0   prom/alertmanager                             "/bin/alertmanager -…"   5 minutes ago    Up 5 minutes              k8s_alertmanager_alertmanager-main-0_kubesphere-monitoring-system_d4d538de-a7fc-4990-92bb-67a05e8b5fb3_0
285402dd9ef4   kubesphere/pause:3.4.1                        "/pause"                 5 minutes ago    Up 5 minutes              k8s_POD_notification-manager-operator-7d44854f54-lmvt8_kubesphere-monitoring-system_abf70a62-f110-492c-983c-174230dbe354_0
c7d91da7b61a   kubesphere/kube-rbac-proxy                    "/usr/local/bin/kube…"   6 minutes ago    Up 6 minutes              k8s_kube-rbac-proxy_prometheus-operator-5c5db79546-cs47w_kubesphere-monitoring-system_9c234076-e562-4b5d-8d0a-36a957a8e783_0
e416db2686d9   kubesphere/kube-state-metrics                 "/kube-state-metrics…"   6 minutes ago    Up 6 minutes              k8s_kube-state-metrics_kube-state-metrics-5547ddd4cc-8gmzt_kubesphere-monitoring-system_72c5e270-8c12-4b7e-be8a-a67007147841_0
c1d8c91dcaca   prom/node-exporter                            "/bin/node_exporter …"   6 minutes ago    Up 6 minutes              k8s_node-exporter_node-exporter-px22q_kubesphere-monitoring-system_5770efd5-7df5-4b40-b9d0-fd1f67abf0a4_0
ad6043cffaee   kubesphere/pause:3.4.1                        "/pause"                 7 minutes ago    Up 7 minutes              k8s_POD_alertmanager-main-0_kubesphere-monitoring-system_d4d538de-a7fc-4990-92bb-67a05e8b5fb3_0
a3393a75fbfa   kubesphere/prometheus-operator                "/bin/operator --kub…"   7 minutes ago    Up 7 minutes              k8s_prometheus-operator_prometheus-operator-5c5db79546-cs47w_kubesphere-monitoring-system_9c234076-e562-4b5d-8d0a-36a957a8e783_0
41f30e2f4518   kubesphere/pause:3.4.1                        "/pause"                 7 minutes ago    Up 7 minutes              k8s_POD_kube-state-metrics-5547ddd4cc-8gmzt_kubesphere-monitoring-system_72c5e270-8c12-4b7e-be8a-a67007147841_0
880e0ec23330   kubesphere/pause:3.4.1                        "/pause"                 7 minutes ago    Up 7 minutes              k8s_POD_node-exporter-px22q_kubesphere-monitoring-system_5770efd5-7df5-4b40-b9d0-fd1f67abf0a4_0
a4423b96f988   kubesphere/pause:3.4.1                        "/pause"                 7 minutes ago    Up 7 minutes              k8s_POD_prometheus-operator-5c5db79546-cs47w_kubesphere-monitoring-system_9c234076-e562-4b5d-8d0a-36a957a8e783_0
0713f577689d   mirrorgooglecontainers/defaultbackend-amd64   "/server"                10 minutes ago   Up 10 minutes             k8s_default-http-backend_default-http-backend-5bf68ff9b8-s8fg9_kubesphere-controls-system_334554f8-742c-4916-9602-20c41fb46687_0
c476b185eca2   kubesphere/ks-console                         "docker-entrypoint.s…"   11 minutes ago   Up 11 minutes             k8s_ks-console_ks-console-65f4d44d88-lhrhn_kubesphere-system_1eebb6e1-77a6-4f2b-b6dd-5d06201ba50a_0
915269bad362   kubesphere/pause:3.4.1                        "/pause"                 11 minutes ago   Up 10 minutes             k8s_POD_default-http-backend-5bf68ff9b8-s8fg9_kubesphere-controls-system_334554f8-742c-4916-9602-20c41fb46687_0
892afa1d6f41   kubesphere/pause:3.4.1                        "/pause"                 11 minutes ago   Up 11 minutes             k8s_POD_ks-console-65f4d44d88-lhrhn_kubesphere-system_1eebb6e1-77a6-4f2b-b6dd-5d06201ba50a_0
87ade779eb4b   csiplugin/snapshot-controller                 "/snapshot-controlle…"   13 minutes ago   Up 13 minutes             k8s_snapshot-controller_snapshot-controller-0_kube-system_57b2b84d-73f7-4f73-be2c-fe5b644d2166_0
d409d6877100   kubesphere/pause:3.4.1                        "/pause"                 14 minutes ago   Up 14 minutes             k8s_POD_snapshot-controller-0_kube-system_57b2b84d-73f7-4f73-be2c-fe5b644d2166_0
701e02c0e155   kubesphere/ks-installer                       "/shell-operator sta…"   14 minutes ago   Up 14 minutes             k8s_installer_ks-installer-57bdbbf866-rflmb_kubesphere-system_19fe77fd-e284-4a1b-8001-8ad9ab8bb72a_0
fea3a2dd2bbe   openebs/provisioner-localpv                   "/usr/local/bin/prov…"   15 minutes ago   Up 15 minutes             k8s_openebs-provisioner-hostpath_openebs-localpv-provisioner-5bfb67894-ss5rr_kube-system_1a5a1562-6290-44b4-9832-46275abab02e_0
44d585914e7c   76ba70f4748f                                  "/usr/bin/kube-contr…"   16 minutes ago   Up 16 minutes             k8s_calico-kube-controllers_calico-kube-controllers-846b5f484d-zhhfz_kube-system_98d57d33-cde2-4e53-9a80-1d4725cb4854_0
505861c73e9d   296a6d5035e2                                  "/coredns -conf /etc…"   16 minutes ago   Up 16 minutes             k8s_coredns_coredns-b5648d655-jq7c9_kube-system_c588a69a-2bb1-40d8-9af9-de413002be1c_0
5cabab158b9b   296a6d5035e2                                  "/coredns -conf /etc…"   16 minutes ago   Up 16 minutes             k8s_coredns_coredns-b5648d655-vj27d_kube-system_22a5751f-cbe3-4502-9946-8195f4857af0_0
8a79445d4d23   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_calico-kube-controllers-846b5f484d-zhhfz_kube-system_98d57d33-cde2-4e53-9a80-1d4725cb4854_0
8c1fbe9f2505   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_coredns-b5648d655-jq7c9_kube-system_c588a69a-2bb1-40d8-9af9-de413002be1c_0
91986c7d5aac   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_coredns-b5648d655-vj27d_kube-system_22a5751f-cbe3-4502-9946-8195f4857af0_0
eea07d7ac04f   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_ks-installer-57bdbbf866-rflmb_kubesphere-system_19fe77fd-e284-4a1b-8001-8ad9ab8bb72a_0
a5a53bbef628   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_openebs-localpv-provisioner-5bfb67894-ss5rr_kube-system_1a5a1562-6290-44b4-9832-46275abab02e_0
1ecb779dc559   5ef66b403f4f                                  "start_runit"            16 minutes ago   Up 16 minutes             k8s_calico-node_calico-node-6tcxw_kube-system_f9e3f88a-7a93-46ef-bc1d-169499d4b46c_0
b915ae317cb9   5340ba194ec9                                  "/node-cache -locali…"   16 minutes ago   Up 16 minutes             k8s_node-cache_nodelocaldns-rrjm4_kube-system_fa933637-3820-4928-824c-786d9d04726d_0
811c9a921570   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_calico-node-6tcxw_kube-system_f9e3f88a-7a93-46ef-bc1d-169499d4b46c_0
9132527c3b84   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_nodelocaldns-rrjm4_kube-system_fa933637-3820-4928-824c-786d9d04726d_0
052654e47894   e08abd2be730                                  "/usr/local/bin/kube…"   16 minutes ago   Up 16 minutes             k8s_kube-proxy_kube-proxy-rl6cd_kube-system_30bd16dc-d903-43ac-9097-7ca81d8d50a3_0
3f8fc2c40807   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_kube-proxy-rl6cd_kube-system_30bd16dc-d903-43ac-9097-7ca81d8d50a3_0
fcb14f803f14   8e60ea3644d6                                  "kube-scheduler --au…"   16 minutes ago   Up 16 minutes             k8s_kube-scheduler_kube-scheduler-localhost.localdomain.cluster.local_kube-system_7cf4cd863cc5ab487dd736d4522d6f12_0
ab6bcef42a15   7b2ac941d4c3                                  "kube-apiserver --ad…"   16 minutes ago   Up 16 minutes             k8s_kube-apiserver_kube-apiserver-localhost.localdomain.cluster.local_kube-system_0adb32c5ad26f03fb28bb9ab8edaa102_0
a8b4d6f447e1   184ef4d127b4                                  "kube-controller-man…"   16 minutes ago   Up 16 minutes             k8s_kube-controller-manager_kube-controller-manager-localhost.localdomain.cluster.local_kube-system_b9a94bd9cc5c6634574a714b347777e4_0
d47a1ecabaec   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_kube-scheduler-localhost.localdomain.cluster.local_kube-system_7cf4cd863cc5ab487dd736d4522d6f12_0
747bb4a37c24   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_kube-controller-manager-localhost.localdomain.cluster.local_kube-system_b9a94bd9cc5c6634574a714b347777e4_0
7af423fd5f87   kubesphere/pause:3.4.1                        "/pause"                 16 minutes ago   Up 16 minutes             k8s_POD_kube-apiserver-localhost.localdomain.cluster.local_kube-system_0adb32c5ad26f03fb28bb9ab8edaa102_0

思考:我们安装k8s需要解决哪些问题?

以优先级高地排名吧

  1. 服务高可用问题
  2. 服务纯离线部署问题
  3. 服务devops问题
  4. 服务监控问题
 类似资料: