参考连接:
https://minikube.sigs.k8s.io/docs/start/
https://github.com/kubernetes/minikube/issues/4043
版本:
minikube 1.23.1
virtualbox 6.1.26_145957_el7-1
centos 7.9.2009
kubectl 1.22.1
虚拟机环境:
Hyber-V 2Core 4096MB 50G
ExposeVirtualizationExtensions True(已打开对应虚拟机的嵌套虚拟化)
1.更新Centos7到最新版本
su root
yum install epel-release
yum makecache
yum update -y
2.安装VirtualBox
根据minikube的issues 4043,需要安装VirtualBox 6.+版本才能正常工作。
vi /etc/yum.repo.d/virtualbox.repo
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox.asc
安装相关依赖
yum install gcc make perl
yum install kernel-devel
`
yum makecache
yum search VirtualBox
yum install VirtualBox-6.1 -y
如果先安装Virtual Box后安装依赖,还需要运行:
vboxconfig
3.安装minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm
sudo rpm -Uvh minikube-latest.x86_64.rpm
4.添加用户
useradd -G vboxusers k8s
echo "k8s ALL=(ALL) NOPASSWORD:ALL" >> /etc/sudoers
5.安装kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.22.1/bin/linux/amd64/kubectl
chmod +x kubectl
mv kubectl /usr/local/bin/
6.运行minikube
su k8s
minikube start