基于AnolisOS 8.6+minikube部署单机版K8S

测试环境

AnolisOS-8.6-x86_64-minimal.iso
Virtual Box,2 vCPU, 4G RAM, 40 vDisk

系统配置

关闭Selinux,[默认是关闭]
sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#g’ /etc/selinux/config
cat /etc/selinux/config
关闭防火墙
systemctl disable --now firewalld
systemctl stop firewalld
systemctl status firewalld
开启NTP同步
systemctl enable chronyd
systemctl start chronyd
systemctl status chronyd
chronyc sources -v
timedatectl
date
修改主机名
hostnamectl set-hostname --static node
echo “192.168.1.48 node” >> /etc/hosts
cat /etc/hosts

安装工具

curl -LO https://github.com/containernetworking/plugins/releases/download/v1.4.1/cni-plugins-linux-amd64-v1.4.1.tgz
mkdir -p /opt/cni/bin
tar -xf cni-plugins-linux-amd64-v1.4.1.tgz -C /opt/cni/bin

yum install -y conntrack-tools cri-tools

安装cri-dockerd

curl -LO https://github.com/Mirantis/cri-dockerd/releases/download/v0.3.14/cri-dockerd-0.3.14-3.el8.x86_64.rpm
rpm -ivh cri-dockerd-0.3.14-3.el8.x86_64.rpm

配置Docker和Kubernetes的软件包仓库

Docker 软件仓库
cat > /etc/yum.repos.d/docker-ce.repo << EOF
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
EOF

Kubernetes 软件仓库
cat > /etc/yum.repos.d/kubernetes.repo << EOF
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

#清除,更新缓存
yum clean all && yum makecache

安装kubectl

yum install -y kubectl

安装docker

yum -y install docker-ce
docker version

安装minikube

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm
rpm -Uvh minikube-latest.x86_64.rpm
minikube start --driver=none --image-mirror-country=‘cn’ --kubernetes-version=v1.27.12 --image-repository=‘registry.cn-hangzhou.aliyuncs.com/google_containers’

验证环境

kubectl get nodes
kubectl get pods --all-namespaces

开启控制台[可选]

minikube dashboard
http://127.0.0.1:35465/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/

因为是本地Windows电脑装了Virtual Box, 在Virtual Box上装的龙蜥虚拟机,默认是无法从Windows上访问。如果需要在宿主机Windows系统里访问这个dashboard,配置代理:
kubectl proxy --port=8000 --address=‘192.168.1.48’ --accept-hosts='^.'*
在浏览器访问:
http://192.168.1.48:8000/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/#/overview?namespace=default

开启Addon 组件[可选]

minikube addons list
minikube addons enable kubevirt

移除环境

minikube delete

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值