# minikube on CentOS with Proxy >[参考](https://github.com/kubernetes/minikube) #### 环境 192.168.137.250 minikube.example.com minikube: 0.25 CentOS: 7.4 docker: 1.12.6 *防火墙、SELinix已经关闭* #### 前期准备 1. 设置域名 ``` echo minikube.example.com > /etc/hostname cat <<EOF >> /etc/hosts 192.168.137.250 minikube.example.com minikube EOF ``` 2. 关闭交换区 `swapoff -a` 注释掉 /etc/fstab 有关 swap 的行 ***最好重启一下 `init 6`*** 3. 安装 docker ``` #更新 docker 源 cd /etc/yum.repos.d/ wget https://download.docker.com/linux/centos/docker-ce.repo #显示所有docker yum list docker-ce --show-duplicates | sort -i #安装下列版本(最新版本的 cgroup 和 minikube 不兼容) yum install -y docker-ce-17.09.0.ce-1.el7.centos #设置 docker 代理 mkdir -p /etc/systemd/system/docker.service.d cat << EOF > /etc/systemd/system/docker.service.d/http-proxy.conf [Service] Environment="HTTP_PROXY=http://192.168.137.1:1080" "HTTPS_PROXY=http://192.168.137.1:1080" "NO_PROXY=localhost,127.0.0.1,192.168.*,10.*" EOF #启动 systemctl daemon-reload systemctl enable docker systemctl start docker ``` 4. 安装 minikube ``` #设置系统代理 export http_proxy=http://192.168.137.1:1080 export https_proxy=http://192.168.137.1:1080 export no_proxy=localhost,127.0.0.1,192.168.*,10.* #貌似不起作用,后面要手动停止代理 curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube curl -Lo kubectl 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 mv kubectl /usr/local/bin/ mv minikube /usr/local/bin/ #设置 minikube 环境 export MINIKUBE_WANTUPDATENOTIFICATION=false export MINIKUBE_WANTREPORTERRORPROMPT=false export MINIKUBE_HOME=$HOME export CHANGE_MINIKUBE_NONE_USER=true mkdir $HOME/.kube || true touch $HOME/.kube/config export KUBECONFIG=$HOME/.kube/config ``` 5. 初始化 minikube 5.1. 第一次运行获得安装版本号 `minikube start --vm-driver=none` 当出现 *下载完成 开启启动集群* 的时候,按 ctrl+c 停止 5.2 再次安装 ``` #解除系统代理 unset http_proxy unset https_proxy #清理 kubeadm reset #重新运行 minikube start --vm-driver=none ==============以下为成功后的输出========================= [root@minikube ~]# minikube start --vm-driver=none Starting local Kubernetes v1.10.0 cluster... Starting VM... Getting VM IP address... Moving files into cluster... Setting up certs... Connecting to cluster... Setting up kubeconfig... Starting cluster components... Kubectl is now configured to use the cluster. =================== WARNING: IT IS RECOMMENDED NOT TO RUN THE NONE DRIVER ON PERSONAL WORKSTATIONS The 'none' driver will run an insecure kubernetes apiserver as root that may leave the host vulnerable to CSRF attacks ``` 6. dashboard minikube dashboard
minikube on CentOS with Proxy
最新推荐文章于 2025-03-31 20:21:03 发布