天天看点

轻松掌握KubeKey单节点和集群安装k8s和kubesphere

作者:轻松入门网

1、KubeKey单节点AllInOne装kubesphere及k8s

如果只想安装k8s,注意在命令里不指定kubesphere即可。

1、设置hostname

hostnamectl set-hostname k8s-node05

2、准备KubeKey

export KKZONE=cn

curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -

chmod +x kk           

3、使用KubeKey引导安装

./kk create cluster --with-kubernetes v1.20.4 --with-kubesphere v3.1.1
#可能需要下面命令
yum install -y conntrack           

由于我用的centos8,报了如下错误,解决方法是执行:yum install --allowerasing docker-ce

轻松掌握KubeKey单节点和集群安装k8s和kubesphere

如下安装完成:

轻松掌握KubeKey单节点和集群安装k8s和kubesphere

4、启用需要的组件

1、启用DevOps

在官网上也有介绍。

轻松掌握KubeKey单节点和集群安装k8s和kubesphere

2、KubeKey集群装kubesphere及k8s

如果只想安装k8s,注意在命令里不指定kubesphere即可。

1、设置三台hostname

hostnamectl set-hostname k8s-master02
hostnamectl set-hostname k8s-node03
hostnamectl set-hostname k8s-node04           
轻松掌握KubeKey单节点和集群安装k8s和kubesphere

2、下载KubeKey

在主节点执行如下

export KKZONE=cn

curl -sfL https://get-kk.kubesphere.io | VERSION=v1.1.1 sh -

chmod +x kk           

3、创建修改集群配置文件

在主节点执行创建配置文件命令

./kk create config --with-kubernetes v1.20.4 --with-kubesphere v3.1.1           

修改生成的配置文件config-sample.yaml,修改节点信息、修改etcd安装位置

轻松掌握KubeKey单节点和集群安装k8s和kubesphere

4、使用KubeKey引导安装集群

./kk create cluster -f config-sample.yaml           
轻松掌握KubeKey单节点和集群安装k8s和kubesphere

如果要卸载则执行:./kk delete cluster config-sample.yaml

继续阅读