在centos7.9上以 All-in-One 模式安装 KubeSphere

文章目录

  • 前言
  • 一、什么是 KubeSphere?
  • 二、环境准备
    • 1.虚拟机准备
    • 2.基础环境准备
    • 3.安装docker服务
    • 4.下载KubeKey安装工具
    • 5.开始安装
    • 6.安装结束,登陆验证
  • 总结


前言

在centos7.9上以 All-in-One 模式安装 KubeSphere,在虚拟机上安装
官网网地址:https://www.kubesphere.io/zh/docs/v3.3/quick-start/all-in-one-on-linux/


一、什么是 KubeSphere?

KubeSphere 是在 Kubernetes 之上构建的面向云原生应用的分布式操作系统,完全开源,支持多云与多集群管理,提供全栈的 IT 自动化运维能力,简化企业的 DevOps 工作流。它的架构可以非常方便地使第三方应用与云原生生态组件进行即插即用 (plug-and-play) 的集成。

二、环境准备

1.虚拟机准备

  • 镜像版本:CentOS-7-x86_64-Minimal-2009.iso
  • CPU数量:8核
  • 内存大小:16G
  • 系统盘大小:100G

2.基础环境准备

切换阿里源

mkdir -p /etc/yum.repos.d/CentOS-Base.repo.backup
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
# 没有wget命令的时候,可以用curl命令下载文件
#curl  -o  /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum -y install epel-release

安装基础软件包,关闭selinux

#依赖环境准备
yum install -y socat conntrack yum-utils epel-release vim
#关闭selinux
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux;
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config;
#关闭防火墙
systemctl stop firewalld.service;
systemctl disable firewalld.service;
#重启关闭selinux
reboot 

3.安装docker服务

安装docker服务作为k8s的底层支持

sudo yum-config-manager --add-repo  http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo;
#修改cgroupdriver
mkdir -p /etc/docker/;
cat > /etc/docker/daemon.json <<EOF
{
    "exec-opts":["native.cgroupdriver=systemd"],
    "log-driver":"json-file",
    "log-opts":{
        "max-size":"100m"
    }
}
EOF
#安装软件包
yum install docker-ce docker-ce-cli -y;
#启动服务,设置自启动
systemctl restart docker;
systemctl enable  docker;

4.下载KubeKey安装工具

下载安装工具,因为我的环境访问git受限,所以使用非git模式

# 准备路径
mkdir -p /data/kubesphere-all-in-one/
cd  /data/kubesphere-all-in-one/
export KKZONE=cn
curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.7 sh -
#输出
Downloading kubekey v3.0.7 from https://kubernetes.pek3b.qingstor.com/kubekey/releases/download/v3.0.7/kubekey-v3.0.7-linux-amd64.tar.gz ...
Kubekey v3.0.7 Download Complete!

5.开始安装

开始安装部署,我这里安装指定的1.23.6版本

# 赋予权限
chmod a+x ./kk
# ./kk create cluster [--with-kubernetes version] [--with-kubesphere version]
# 我之前集群的版本是1.23.6, 所以就选定使用1.23.6了,不设置版本的话安装的是1.23.10
./kk create cluster --with-kubernetes v1.23.6 --with-kubesphere
# 按照提示输入yes
Continue this installation? [yes/no]: yes

6.安装结束,登陆验证

验证安装结果,并登陆控制台

# 验证安装结果
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
# 通过输出的信息登陆web控制台
#####################################################
###              Welcome to KubeSphere!           ###
#####################################################

Console: http://192.168.XXX.XXX:30880
Account: admin
Password: P@88w0rd

首次登陆需要修改密码,规则是比较普通的规则

  • 包含至少 1 个大写字母和 1 个小写字母。
  • 包含至少 1 个数字。
  • 包含至少 8 个字符

在centos7.9上以 All-in-One 模式安装 KubeSphere_第1张图片


总结

在线安装还是比较简单的,就是对网络有一点要求,amd64 helm v3.9.0有时候下载会很慢,在阿里云的虚拟机上也是出现了下载慢的问题,导致安装中断

你可能感兴趣的:(k8s,kubernetes)