三.安装kubesphere

该文详细介绍了如何在Kubernetes集群中配置OpenEBS以支持本地存储动态PVC,包括安装iSCSI协议客户端,部署OpenEBS以及创建存储类。接着,文章展示了安装KubeSphere的过程,包括安装资源、检查安装日志和查看服务端口。最后,提供了相关命令行输出作为操作验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.本地存储动态 PVC

# 在所有节点安装 iSCSI 协议客户端(OpenEBS 需要该协议提供存储支持)
yum install iscsi-initiator-utils -y
# 设置开机启动
systemctl enable --now iscsid
# 启动服务
systemctl start iscsid
# 查看服务状态
systemctl status iscsid

# 安装 OpenEBS 
kubectl apply -f https://openebs.github.io/charts/openebs-operator.yaml

# 查看状态(下载镜像可能需要一些时间)
kubectl get all -n openebs

# 在主节点创建本地 storage class
kubectl apply -f default-storage-class.yaml

2.安装

# 安装资源
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.3.1/kubesphere-installer.yaml
kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.3.1/cluster-configuration.yaml

# 检查安装日志
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

# 查看端口
kubectl get svc/ks-console -n kubesphere-system

# 默认端口是 30880,如果是云服务商,或开启了防火墙,记得要开放该端口

# 登录控制台访问,账号密码:admin/P@88w0rd

3.示例

[root@k8s-master kubesphere]# ll
total 76
-rw-r--r-- 1 root root 10070 Jul 26 07:14 cluster-configuration.yaml
-rw-r--r-- 1 root root  1049 Jul 26 07:14 default-storage-class.yaml
-rw-r--r-- 1 root root  7631 Jul 26 07:14 kubesphere-delete.sh
-rw-r--r-- 1 root root   386 Jul 26 07:14 kubesphere-ingress.yaml
-rw-r--r-- 1 root root  4553 Jul 26 07:14 kubesphere-installer.yaml
-rw-r--r-- 1 root root 38283 Jul 26 07:14 openebs-operator.yaml
[root@k8s-master kubesphere]# kubectl apply -f openebs-operator.yaml 
namespace/openebs created
serviceaccount/openebs-maya-operator created
clusterrole.rbac.authorization.k8s.io/openebs-maya-operator created
clusterrolebinding.rbac.authorization.k8s.io/openebs-maya-operator created
customresourcedefinition.apiextensions.k8s.io/blockdevices.openebs.io created
customresourcedefinition.apiextensions.k8s.io/blockdeviceclaims.openebs.io created
configmap/openebs-ndm-config created
daemonset.apps/openebs-ndm created
deployment.apps/openebs-ndm-operator created
deployment.apps/openebs-ndm-cluster-exporter created
service/openebs-ndm-cluster-exporter-service created
daemonset.apps/openebs-ndm-node-exporter created
service/openebs-ndm-node-exporter-service created
deployment.apps/openebs-localpv-provisioner created
storageclass.storage.k8s.io/openebs-hostpath created
storageclass.storage.k8s.io/openebs-device created


[root@k8s-master kubesphere]# kubectl apply -f default-storage-class.yaml 
storageclass.storage.k8s.io/local created


[root@k8s-master kubesphere]# kubectl get sc
NAME               PROVISIONER        RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
local (default)    openebs.io/local   Delete          WaitForFirstConsumer   false                  17m
openebs-device     openebs.io/local   Delete          WaitForFirstConsumer   false                  19m
openebs-hostpath   openebs.io/local   Delete          WaitForFirstConsumer   false                  19m

[root@k8s-master kubesphere]# kubectl apply -f kubesphere-installer.yaml 
customresourcedefinition.apiextensions.k8s.io/clusterconfigurations.installer.kubesphere.io created
namespace/kubesphere-system created
serviceaccount/ks-installer created
clusterrole.rbac.authorization.k8s.io/ks-installer created
clusterrolebinding.rbac.authorization.k8s.io/ks-installer created
deployment.apps/ks-installer created

[root@k8s-master kubesphere]# kubectl get po -n kubesphere-system
NAME                            READY   STATUS    RESTARTS   AGE
ks-installer-7489cf4b66-wj4rc   1/1     Running   0          16m
openldap-0                      0/1     Pending   0          3s


[root@k8s-master kubesphere]# kubectl apply -f cluster-configuration.yaml 
clusterconfiguration.installer.kubesphere.io/ks-installer created

 查看日志:

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

yml附件:

<think>好的,用户想在统信UOS操作系统上安装KubeSphere容器平台。我需要先整理已知的引用内容,看看有没有相关的信息。根据提供的引用,引用[1]和[2]主要讲的是安装统信UOS虚拟机,而引用[3]是关于查询系统安装时间的命令。但用户的问题是关于KubeSphere安装,所以可能需要结合通用的Linux安装步骤,并考虑UOS的兼容性。 首先,我需要确认统信UOS是基于哪个Linux发行版的。通常UOS是基于Debian或Ubuntu的,所以安装步骤可能类似。KubeSphere通常建议在Kubernetes上安装,而Kubernetes对系统有一定的要求,比如Docker、容器运行时、网络配置等。 接下来,我需要列出安装KubeSphere的前置条件,包括系统版本、资源要求(CPU、内存、存储)、依赖软件如Docker、Kubernetes等。可能需要检查UOS的内核版本是否符合要求,以及是否支持相关的容器技术。 然后,具体步骤可能包括配置系统环境(如关闭防火墙、SELinux,配置主机名和hosts文件),安装Docker或其他容器运行时,安装Kubernetes集群,最后部署KubeSphere。需要注意UOS可能有些特定的配置或软件源需要调整,比如使用apt还是其他包管理工具。 注意事项方面,需要提醒用户检查兼容性,特别是UOS的版本是否被KubeSphere支持。另外,网络配置如端口是否开放,存储配置是否正确,以及后续的维护和升级问题。 可能遇到的问题包括依赖包冲突、内核参数需要调整、服务启动失败等,需要给出相应的解决建议,比如查看日志、调整配置等。 最后,生成相关问题,帮助用户深入理解安装过程和相关技术,比如Kubernetes集成、存储配置、网络问题排查等。</think>在统信UOS操作系统上安装KubeSphere容器平台可分为以下步骤: ### 一、前置条件 1. **系统要求** - 建议使用UOS 20或更高版本[^1] - 内核版本不低于4.15(执行`uname -r`验证) - 至少4核CPU/8GB内存/100GB存储 2. **环境准备** ```bash # 关闭防火墙 sudo systemctl stop firewalld && sudo systemctl disable firewalld # 关闭swap sudo swapoff -a && sudo sed -i '/ swap / s/^/#/' /etc/fstab ``` ### 二、具体安装步骤 #### 1. 安装Docker容器运行时 ```bash # 添加Docker仓库 sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" # 安装Docker sudo apt-get update && sudo apt-get install -y docker-ce=5:20.10.14~3-0~ubuntu-focal sudo systemctl enable docker && sudo systemctl start docker ``` #### 2. 安装Kubernetes集群 ```bash # 添加Kubernetes源 sudo apt-get update && sudo apt-get install -y apt-transport-https curl curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list # 安装kubeadm/kubelet sudo apt-get update sudo apt-get install -y kubelet=1.22.5-00 kubeadm=1.22.5-00 kubectl=1.22.5-00 ``` #### 3. 初始化Kubernetes集群 ```bash sudo kubeadm init --pod-network-cidr=10.244.0.0/16 mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config ``` #### 4. 部署KubeSphere ```bash kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.3.1/kubesphere-installer.yaml kubectl apply -f https://github.com/kubesphere/ks-installer/releases/download/v3.3.1/cluster-configuration.yaml # 查看安装进度 kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f ``` ### 、注意事项 1. **兼容性问题** UOS特有的安全增强模块可能需调整安全策略: ```bash sudo setenforce 0 && sudo sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config ``` 2. **存储配置** 建议提前配置StorageClass,可通过OpenEBS实现: ```bash kubectl apply -f https://openebs.github.io/charts/openebs-operator.yaml ``` 3. **网络访问** 确保以下端口开放: - 30000-32767(NodePort范围) - 6443(Kubernetes API) - 30880(KubeSphere控制台) ### 四、验证安装 访问控制台:`http://<节点IP>:30880`,使用默认账号`admin/P@88w0rd`登录
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值