#关闭防火墙或者开放必要的防火墙端口
systemctl stop firewalld
#查看并关闭swapoff分区
swapoff -a
#查看selinux状态
getenforce
#安装依赖组件
yum install -y ebtables socat ipset conntrack
#安装docker
#坚持DNS设置
cat /etc/resolv.conf
#设置kubernetes阿里云仓库镜像
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg
https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
#安装kubelet和kubectl
yum install -y kubelet-1.17.9 kubectl-1.17.9
#下载kubKey
wget -c https://kubesphere.io/download/kubekey-v1.0.0-linux-amd64.tar.gz -o - | tar -xz
#解压得到kk文件
#赋予权限
chmod +x kk
#开始安装
#使用kubekey安装kubernetes和kubesphere
./kk create cluster --with-kubernetes v1.17.9 --with-kubesphere v3.0.0
#验证安装结果
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
**************************************************
#####################################################
### Welcome to KubeSphere! ###
#####################################################
Console: http://192.168.96.132:30880
Account: admin
Password: P@88w0rd
kubeSpher+k8s集群安装命令
于 2022-09-19 21:02:24 首次发布