当前位置:首页 > 系统运维
使用 All-in-One 模式安装 KubeSphere
来源:靑龍一笑的博客  作者:靑龍一笑  发布时间:2021-07-02 17:20:25  点击量:540  评论:0

    在实践过程中发现,主机名即 hostname 不能使用大写字母。

1、关闭防火墙

[root@kubesphere ~]# systemctl disable firewalld
[root@kubesphere ~]# systemctl stop firewalld

2、关闭交换分区

[root@kubesphere ~]# swapoff -a
[root@kubesphere ~]# echo "vm.swappiness=0" >> /etc/sysctl.conf
[root@kubesphere ~]# sysctl -p /etc/sysctl.conf
vm.swappiness = 0
[root@kubesphere ~]# sed -i 's$/dev/mapper/centos-swap$#/dev/mapper/centos-swap$g' /etc/fstab

3、关闭 selinux

[root@kubesphere ~]# getenforce
Enforcing
[root@kubesphere ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
[root@kubesphere ~]# setenforce 0
[root@kubesphere ~]# getenforce
Permissive

4、安装依赖组件

[root@kubesphere ~]# yum install ebtables socat ipset conntrack -y

5、安装 docker

[root@kubesphere ~]# yum install yum-utils -y
[root@kubesphere ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@kubesphere ~]# yum makecache fast
[root@kubesphere ~]# yum install docker-ce docker-ce-cli -y

6、启动 docker

[root@kubesphere ~]# systemctl enable docker && systemctl start docker

7、设置 docker 镜像加速器

[root@kubesphere ~]# cat > /etc/docker/daemon.json << EOF
> {
>   "registry-mirrors": ["https://gqk8w9va.mirror.aliyuncs.com"]
> }
> EOF

8、重启 docker,使配置生效

[root@kubesphere ~]# systemctl restart docker

9、配置 kubernetes yum 源

[root@kubesphere ~]# cat > /etc/yum.repos.d/kubernetes.repo << EOF
> [kubernetes]
> name=Kubernetes
> baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
> enabled=1
> gpgcheck=0
> repo_gpgcheck=0
> gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
>        http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
> EOF
[root@kubesphere ~]# yum makecache fast

10、安装 kubelet 和 kubectl

[root@kubesphere ~]# yum install kubelet kubectl -y

11、下载 kubekey

[root@kubesphere ~]# yum install wget -y
[root@kubesphere ~]# wget -c https://github.com/kubesphere/kubekey/releases/download/v1.1.0/kubekey-v1.1.0-linux-amd64.tar.gz -O - | tar -xz

12、开始安装

    使用 kubekey 安装 kubernetes 和 kubesphere:

[root@kubesphere ~]# export KKZONE=cn
[root@kubesphere ~]# ./kk create cluster --with-kubernetes v1.20.4 --with-kubesphere v3.1.0

    以下根据提示输入 yes:

Continue this installation? [yes/no]: yes

    当出现如下提示信息时,表示安装成功:

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

    可以使用上述命令,验证安装结果。

13、访问 kubesphere console

浏览器访问地址:http://IP:30880
帐号:admin
密码:P@88w0rd


    首次登录,需要修改密码:

版权所有 © 2005-2023 靑龍一笑的博客  Powered by C.S.Ricen
Copyright © 2005-2023 by www.ricensoftwares.com.cn  All Rights Reserved.

欢迎光临本站,这里是靑龍一笑的博客。

因资金匮乏,本站已迁到国外的免费空间,可能导致本站的访问速度较慢,由此给您带来的不便,敬请谅解。

您可以通过下方的“支持本站建设”链接,给本站提供资金支持。

Free Web Hosting