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