k8s 集群部署 kubesphere

一、最小化部署 kubesphere

1、在已有的 Kubernetes 集群上部署 KubeSphere,下载 YAML 文件:

复制代码
wget https://github.com/kubesphere/ks-installer/releases/download/v3.4.0/kubesphere-installer.yaml
wget https://github.com/kubesphere/ks-installer/releases/download/v3.4.0/cluster-configuration.yaml

2、执行以下命令部署 kubesphere:

复制代码
kubectl apply -f kubesphere-installer.yaml
kubectl apply -f cluster-configuration.yaml

二、中途遇到的报错及解决方法

说明:这里基本所有同学都不可能成功安装,因为我们使用的Host Storage存储,因此需要手动创建存储类,会出现以下报错信息:

复制代码
fatal: [localhost]: FAILED! => {
    "assertion": "\"(default)\" in default_storage_class_check.stdout",
    "changed": false,
    "evaluated_to": false,
    "msg": "Default StorageClass was not found !"
}

解决方法如下:

1、创建文件storageclass.yaml

复制代码
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer

2、创建文件persistentVolumeClaim.yaml

复制代码
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: local-pve
spec:
  accessModes:
     - ReadWriteOnce
  resources:
    requests:
      storage: 20Gi
  storageClassName: local-storage

3、修改sc为默认标识为default

复制代码
kubectl patch sc local-storage -p '{"metadata": {"annotations": {"storageclass.beta.kubernetes.io/is-default-class": "true"}}}'
## local-storage 是 sc 的名称

三、重新部署 kubesphere

1、重新执行以下命令即可 kubesphere

复制代码
kubectl apply -f kubesphere-installer.yaml
kubectl apply -f cluster-configuration.yaml

2、检查安装日志:

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

3、安装完成后,您会看到以下消息:

复制代码
#####################################################
###              Welcome to KubeSphere!           ###
#####################################################

Console: http://192.168.122.154: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             2023-10-09 14:16:39
#####################################################

4、查看pod是否正常运行

复制代码
[root@kubernetes-master ~]# kubectl get pod,svc -n kubesphere-system
NAME                                         READY   STATUS    RESTARTS   AGE
pod/ks-apiserver-b7ddc4f5c-ss4kz             1/1     Running   0          26h
pod/ks-console-7c48dd4c9f-n6v7n              1/1     Running   0          26h
pod/ks-controller-manager-854ff655d4-zpv2f   1/1     Running   0          26h
pod/ks-installer-6d7d97c687-mw6m5            1/1     Running   0          26h

NAME                            TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
service/ks-apiserver            ClusterIP   10.109.175.154   <none>        80/TCP         26h
service/ks-console              NodePort    10.97.19.79      <none>        80:30880/TCP   26h
service/ks-controller-manager   ClusterIP   10.103.231.3     <none>        443/TCP        26h

四、登录 kubesphere 控制台



相关推荐
项目題供诗4 小时前
黑马k8s(四)
云原生·容器·kubernetes
杰克逊的日记4 小时前
大项目k8s集群有多大规模,多少节点,有多少pod
云原生·容器·kubernetes
小张童鞋。4 小时前
k8s之k8s集群部署
云原生·容器·kubernetes
long_21454 小时前
k8s中ingress-nginx介绍
kubernetes·ingress-nginx
luck_me54 小时前
k8s v1.26 实战csi-nfs 部署
linux·docker·云原生·容器·kubernetes
邪恶的贝利亚4 小时前
《Docker 入门与进阶:架构剖析、隔离原理及安装实操》
docker·容器·架构
一直学下去5 小时前
K8S中构建双架构镜像-从零到成功
容器·kubernetes·cicd·多架构
知其_所以然5 小时前
使用docker安装clickhouse集群
clickhouse·docker·容器
hnlucky6 小时前
《基于 Kubernetes 的 WordPress 高可用部署实践:从 MariaDB 到 Nginx 反向代理》
运维·数据库·nginx·云原生·容器·kubernetes·mariadb
_板栗_7 小时前
livenessProbe 和 readinessProbe 最佳实践
云原生·容器·kubernetes