版权声明:欢迎转载,请注明出处,谢谢。 https://blog.csdn.net/boling_cavalry/article/details/91304127
在linux安装minikube时遇到两个问题,在此记录整个安装过程,希望能够给遇见同样问题的读者一些参考;
本次部署实战需要先解决谷歌镜像的下载问题,请确保您的网络可以正常访问和下载这些资源;
在安装minikube之前,要先对电脑做些设置,例如swap、防火墙、selinux等,这些操作的步骤和细节请参照《CentOS7环境部署kubenetes1.12版本五部曲之一:标准化机器》
完成基本设置就可以正式开始了;
部署的第一步是对修改docker的cgroup driver设置,使其和即将安装的kubelet服务保持一致,否则会导致kubelet启动失败:
systemctl daemon-reload && systemctl restart docker
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
[root@minikubeblog ~]# kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.2", GitCommit:"66049e3b21efe110454d67df4fa62b08ea79a19b", GitTreeState:"clean", BuildDate:"2019-05-16T16:23:09Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?
从上述信息可见kubect已经可用,但是还连接不上server端,接下来我们就来安装和启动minikube;
minikube有以下两种运行方式:
为了快速安装,今天实战用到的是上面的第二种方式;
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \
&& chmod +x minikube
sudo cp minikube /usr/local/bin && rm minikube
minikube start --vm-driver=none
等待一段时间后(和下载镜像的速度有关),minikube启动成功,执行kubectl get services查看服务正常:
[root@minikubeblog ~]# minikube start --vm-driver=none
* minikube v1.1.1 on linux (amd64)
* Creating none VM (CPUs=2, Memory=2048MB, Disk=20000MB) ...
* Configuring environment for Kubernetes v1.14.3 on Docker 1.13.1
* Unable to load cached images: loading cached images: loading image /root/.minikube/cache/images/gcr.io/k8s-minikube/storage-provisioner_v1.8.1: stat /root/.minikube/cache/images/gcr.io/k8s-minikube/storage-provisioner_v1.8.1: no such file or directory
* Downloading kubeadm v1.14.3
* Downloading kubelet v1.14.3
* Pulling images ...
* Launching Kubernetes ...
* Configuring local host environment ...
! The 'none' driver provides limited isolation and may reduce system security and reliability.
! For more information, see:
- https://github.com/kubernetes/minikube/blob/master/docs/vmdriver-none.md
! kubectl and minikube configuration will be stored in /root
! To use kubectl or minikube commands as your own user, you may
! need to relocate them. For example, to overwrite your own settings:
- sudo mv /root/.kube /root/.minikube $HOME
- sudo chown -R $USER $HOME/.kube $HOME/.minikube
* This can also be done automatically by setting the env var CHANGE_MINIKUBE_NONE_USER=true
* Verifying: apiserver proxy etcd scheduler controller dns
* Done! kubectl is now configured to use "minikube"
[root@minikubeblog ~]# kubectl get services
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 7m10s
至此,Linux环境部署和启动minikube成功,希望本文能给你在部署minikube时提供一些参考。