Minikube安装

2021-06-07  本文已影响0人  袁先生的笔记

前言

Minikube可在本地快速启动一个Kubernetes环境,用来开发和测试

环境

系统:CentOS 7.2

准备

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
yum install conntrack-tools

安装

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
minikube start --driver=none --image-repository=registry.aliyuncs.com/google_containers

--driver=none 在虚拟机上运行时需要使用此参数
--image-repository=registry.aliyuncs.com/google_containers 默认镜像库gcr.io在国内一般无法访问,替换为阿里云的(但部分功能拉取image失败,后面有解决方法)

minikube status
minikube stop
minikube delete

修复

解决pod/storage-provisioner拉取image失败
kubectl -n kube-system get pods

会看到storage-provisioner状态是magePullBackOff
kubectl -n kube-system describe pods storage-provisioner

会看到image地址是registry.aliyuncs.com/google_containers/k8s-minikube/storage-provisioner
kubectl -n kube-system edit pod/storage-provisioner

原来 registry.aliyuncs.com/google_containers/k8s-minikube/storage-provisioner
正确 registry.aliyuncs.com/google_containers/storage-provisioner

启用功能

启用Ingress
minikube addons enable ingress

此时因为image地址错误,会卡住,新开窗口执行以下命令
kubectl -n ingress-nginx get all
kubectl -n ingress-nginx edit pod/ingress-nginx-admission-create-xxxxx

原来 registry.aliyuncs.com/google_containers/docker.io/jettech/kube-webhook-certgen
正确 docker.io/jettech/kube-webhook-certgen
kubectl -n ingress-nginx edit pod/ingress-nginx-admission-patch-xxxxx

原来 registry.aliyuncs.com/google_containers/docker.io/jettech/kube-webhook-certgen
正确 docker.io/jettech/kube-webhook-certgen
kubectl -n ingress-nginx edit deployment/ingress-nginx-controller 

原来 registry.aliyuncs.com/google_containers/ingress-nginx/controller
正确 registry.aliyuncs.com/google_containers/nginx-ingress-controller
上一篇 下一篇

猜你喜欢

热点阅读