一次完成minikube安裝


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:

kubectl get po -A

Alternatively, minikube can download the appropriate version of kubectl, if you don’t mind the double-dashes in the command-line:

minikube kubectl -- get po -A

Initially, some services such as the storage-provisioner, may not yet be in a Running state. This is a normal condition during cluster bring-up, and will resolve itself momentarily. For additional insight into your cluster state, minikube bundles the Kubernetes Dashboard, allowing you to get easily acclimated to your new environment:(內網可訪問,公網需要轉發)

minikube dashboard 
 

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
 
 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM