一次完成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