CentOS 安装部署KubeSphere管理kubernetes

一、关闭防火墙

systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld

第二步:关闭swap分区

swapoff -a
echo "vm.swappiness=0" >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf

第三步:配置epel源

rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

第四步:更新yum

yum -y update

第五步:安装依赖组件

yum install -y ebtables socat ipset conntrack

第六步:在安装前请先检查hostname,如果不符合规则会报以下错误

error: Pipeline[CreateClusterPipeline] execute failed: Module[InitKubernetesModule] exec failed: 
failed: [VM-20-8-centos] [AddWorkerLabel] exec failed after 5 retires: add worker label failed: Failed to exec command: sudo -E /bin/bash -c "/usr/local/bin/kubectl label --overwrite node VM-20-8-centos node-role.kubernetes.io/worker=" 
Error from server (NotFound): nodes "VM-20-8-centos" not found: Process exited with status 1

这时候就需要修改hostname,因为我们是单机安装就设置为master吧,执行以下命令

hostnamectl --static set-hostname master
设置完成后使用hostnamectl status命令进行核验

第7步:下载 KubeKey

先执行以下命令以确保您从正确的区域下载 KubeKey。

export KKZONE=cn

执行以下命令下载 KubeKey。

curl -sfL https://get-kk.kubesphere.io | VERSION=v2.2.2 sh -

为 kk 添加可执行权限:

chmod +x kk

第8步:开始安装
在本快速入门教程中,您只需执行一个命令即可进行安装,其模板如下所示:

./kk create cluster [--with-kubernetes version] [--with-kubesphere version]

若要同时安装 Kubernetes 和 KubeSphere,可参考以下示例命令:

./kk create cluster --with-kubernetes v1.22.10 --with-kubesphere v3.3.0

第9步:验证安装结果
输入以下命令以检查安装结果。

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

成功输出

#####################################################
###              Welcome to KubeSphere!           ###
#####################################################

Console: http://192.168.0.2: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             20xx-xx-xx xx:xx:xx
#####################################################
  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
您好!要在CentOS 7上安装KubeSphere,可以按照以下步骤进行操作: 1. 首先,确保您的CentOS 7系统已经安装DockerKubernetes。如果尚未安装,可以使用以下命令进行安装: ```shell # 安装Docker sudo yum install -y docker # 启动Docker服务 sudo systemctl start docker # 设置Docker开机自启 sudo systemctl enable docker # 安装Kubernetes sudo yum install -y kubernetes # 启动Kubernetes服务 sudo systemctl start kubelet # 设置Kubernetes开机自启 sudo systemctl enable kubelet ``` 2. 确保您的CentOS 7系统上已经安装了Helm。如果尚未安装,可以使用以下命令进行安装: ```shell # 添加Helm的官方仓库 helm repo add stable https://charts.helm.sh/stable # 更新仓库索引 helm repo update # 安装Helm客户端 sudo yum install -y helm ``` 3. 使用以下命令下载并安装KubeSphere: ```shell # 创建一个名为kubesphere的目录 mkdir kubesphere && cd kubesphere # 下载KubeSphere的安装文件 curl -L -O https://github.com/kubesphere/ks-installer/releases/download/v3.1.0/kubesphere-installer.yaml # 使用Helm安装KubeSphere helm install kubesphere-installer kubesphere-installer.yaml -n kubesphere-system ``` 4. 等待安装完成,您可以使用以下命令检查KubeSphere组件的状态: ```shell kubectl get pods -n kubesphere-system ``` 确保所有的组件都处于"Running"状态。 安装完成后,您可以使用浏览器访问KubeSphere的Web控制台。默认情况下,您可以使用admin用户登录,密码为"kubesphere"。请确保根据您的实际需求进行必要的配置和调整。 希望这些信息能对您有所帮助!如果您有更多问题,请随时提问。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

淡忘_cx

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值