kubesphere部署k8s-v1.23.10

文档地址:

官方文档
支持矩阵

前置条件

1.设置主机名称

vi  /etc/hosts

2.关闭防火墙或者放行指定端口

sudo systemctl disable --now firewalld
sudo systemctl disable --now dnsmasq
sudo systemctl disable --now NetworkManager

端口详情

3.设置docker 镜像仓库地址

/etc/docker/daemon.json

{
"registry-mirrors": ["https://gqs7xcfd.mirror.aliyuncs.com","https://hub-mirror.c.163.com"]vi /
}

4.安装依赖组件

yum intsall xxx

yum install -y conntrack socat

安装k8s 集群

1.安装kubKey插件

下载:

方式1:
1.#设置下载地区
export KKZONE=cn
#下载kubey插件下载脚本
#VERSION=v3.0.13 表示下载 v3.0.13 版本,可以指定想要的版本 curl -sfL https://get-kk.kubesphere.io | VERSION=v3.0.13 sh -
执行下载的下的脚本文件回执行安装kubekey, chmod +x downloadKubekey.sh
./downloadKubekey.sh 并在当前目录下生成一个kk,sh文件 方式2:从git选择版本下载解压使用
https://github.com/kubesphere/kubekey/releases 方式3:从源代码生成二进制文件 git
clone https://github.com/kubesphere/kubekey.git cd kubekey make kk

使用:

创建配置文件:
1.授权kk.sh 脚本执行权限 chmod +x kk.sh
#创建配置文件 ./kk create config [–with-kubernetes version] [–with-kubesphere version] [(-f | --file) path]
#参数说明: 指定k8s安装的版本 [–with-kubernetes version] 指定安装kubesphere 的版本
–with-kubesphere version 指定生成配置文件的路径和名字 [(-f | --file) path] 命令示例: 生成配置安装 kubernetes v1.23.10和 kubesphere v3.4.0版本的配置文件 配置文件名为
config-sample.yaml ./kk create config --with kubernetes v1.23.10
–with-kubesphere v3.4.0 -f ./config-sample.yaml

支持矩阵:
kubesphere部署k8s-v1.23.10_第1张图片

2.创建集群

./kk create cluster -f config-sample.yaml

3.访问控制台

NodeIP:30880 使用默认帐户和密码 (admin/P@88w0rd) 访问 KubeSphere 的 Web 控制台

4.用户手册

https://kubesphere.io/zh/docs/v3.4/project-user-guide/

5.复制主节点admin.config文件到从节点

从节点可能无法执行 kubeclt 命令报错如下

kubesphere部署k8s-v1.23.10_第2张图片

解决

#从主节点的 /etc/kubernetes/admin.config 拷贝到从节点的 etc/kubernetes

scp admin.conf [email protected]:/etc/kubernetes/admin.conf

#配置从节点的环境变量 echo “export KUBECONFIG=/etc/kubernetes/admin.conf” >> ~/.bash_profile

#立即生效 source ~/.bash_profile

你可能感兴趣的:(kubernetes,容器,云原生)