k8s官方:https://kubernetes.io/zh/docs/tutorials/hello-minikube/
minikube官网:https://minikube.sigs.k8s.io/docs/start/
1.服务器要求
What you’ll need
- 2 CPUs or more
- 2GB of free memory
- 20GB of free disk space
- Internet connection
- Container or virtual machine
使用centos7.7 阿里云服务器
2.安装docker
yum install docker
service docker start
添加docker组,将当前用户加入该组,新建用户加入该组
- sudo groupadd docker
- sudo usermod -aG docker ${USER}
- useradd k8stest
- passwd k8stest
- sudo usermod -aG docker k8stest
- service docker restart
3.安装minikube
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube start
报错,切换非root用户执行
* minikube v1.18.1 on Centos 7.7.1908 (amd64)
* Automatically selected the docker driver. Other choices: none, ssh
* The "docker" driver should not be used with root privileges.
* If you are running minikube within a VM, consider using --driver=none:
* https://minikube.sigs.k8s.io/docs/reference/drivers/none/
X Exiting due to DRV_AS_ROOT: The "docker" driver should not be used with root privileges.
su k8stest
minikube start
4.通过minikube 使用kubectl
If you already have kubectl installed, you can now use it to access your shiny new cluster:
Alternatively, minikube can download the appropriate version of kubectl, if you don’t mind the double-dashes in the command-line:
5.在 Linux 上使用 curl 安装 kubectl 可执行文件
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client