前置条件
#关闭防火墙
systemctl disable --now firewalld
#关闭
SELinux setenforce 0
#关闭
swap swapoff -a echo "vm.swappiness=0" >> /etc/sysctl.conf sysctl -p /etc/sysctl.conf sed -ri 's/.swap./#&/' /etc/fstab
#内核参数设置
cat > /etc/sysctl.d/k8s.conf << EOF net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 net.ipv4.ip_forward = 1 EOF sysctl --system
#时间同步
yum install -y ntpdate ntpdate time.windows.com
#检查 DNS
cat /etc/resolv.conf
#安装依赖组件
yum install -y curl socat conntrack
单节点时需要执行
kubectl taint nodes --all node-role.kubernetes.io/master
从 v3.0.0 开始,KubeSphere 将基于 ansible 的安装程序更改为使用 Go 语言开发的名为 KubeKey 的新安装程序。使用 KubeKey,您可以轻松、高效、灵活地单独或整体安装 Kubernetes 和 KubeSphere。
有三种情况可以使用 KubeKey。
- 仅安装 Kubernetes
- 用一个命令中安装 Kubernetes 和 KubeSphere
- 首先安装 Kubernetes,然后使用 ks-installer 在其上部署 KubeSphere
安装(从源代码生成二进制文件)
#如果无法访问 #https://proxy.golang.org/,比如在大陆,请执行
build.sh -p git clone https://github.com/kubesphere/kubekey.git cd kubekey ./build.sh
快速开始
#如果无法访问 https://storage.googleapis.com, 请先执行
export KKZONE=cn. ./kk create cluster [--with-kubernetes version] [--with-kubesphere version]
例子
- 使用默认版本创建一个纯 Kubernetes 集群
./kk create cluster
- 创建指定一个(支持的版本)的 Kubernetes 集群
./kk create cluster --with-kubernetes v1.19.8
- 创建一个部署了 KubeSphere 的 Kubernetes 集群 (例如 --with-kubesphere v3.1.0)
./kk create cluster --with-kubesphere [version]
- 创建一个指定的 container runtime 的 Kubernetes 集群(docker, crio, containerd and isula)
./kk create cluster --container-manager containerd
使用YMAL的方式创建
./kk create config [--with-kubernetes version] [--with-kubesphere version] [(-f | --filename) path]
例子:
- 使用默认配置创建一个示例配置文件。您也可以指定文件名称或文件所在的文件夹。
./kk create config [-f ~/myfolder/config-sample.yaml]
- 同时安装 KubeSphere
./kk create config --with-kubesphere
使用配置文件创建集群。
./kk create cluster -f ~/myfolder/config-sample.yaml
文章评论