一.准备一台干净的centos7.6机器
二.关闭防火墙打上相关补丁和相关系统软件
systemctl stop firewalld
yum install openssh openssl sudo conntrack polkit git telnet -y
三.下载并安装kk
下载downloadKubekey地址为:https://get-kk.kubesphere.io并上传至服务器
export KKZONE=cn
VERSION=v2.0.0 sh - downloadKubekey.sh
export KKZONE=cn
chmod +x kk
四.安装kubernetes和kubesphere
./kk create cluster --with-kubernetes v1.21.5 --with-kubesphere v3.2.1
中途可能会中断三次
1.helm无法下载
下载地址: https://get.helm.sh/helm-v3.6.0-linux-amd64.tar.gz
放置至这一目录:/root/kk/kubekey/helm/v3.6.3/amd64/
cd /root/kk/kubekey/helm/v3.6.3/amd64 && tar -zxf helm-v3.6.3-linux-amd64.tar.gz && mv linux-amd64/helm . && rm -rf *linux-amd64*
cd ~
./kk create cluster --with-kubernetes v1.21.5 --with-kubesphere v3.2.1
2.更改docker的镜像仓库地址
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF' {"exec-opts": ["native.cgroupdriver=systemd"],"registry-mirrors": ["https://vbd65v07.mirror.aliyuncs.com"] } EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl enable docker
重新启动
./kk create cluster --with-kubernetes v1.21.5 --with-kubesphere v3.2.1
3.kubernetes设置master可以调度,并且加入kubectl补全
kubectl taint node vm-4-16-centos node-role.kubernetes.io/master-
kubectl taint node vm-4-13-centos node-role.kubernetes.io/master-
重新启动
./kk create cluster --with-kubernetes v1.21.5 --with-kubesphere v3.2.1
4.查看kubesphere安装情况
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
如出现如下图片则为成功
五.登录kubesphere
访问http://127.0.0.1:30880,用户为admin,密码为P@88w0rd