Minikube安装ingress插件的有效方法

2,584 阅读1分钟

minikube 安装ingress插件(minikube addons enable ingress)的方法很简单,但在国内想安装成功并不简单,基本上拉不下镜像。

image.png

解决办法

  • 启动minikube 使用本地缓存镜像
minikube start --cache-images=true  --driver=none --kubernetes-version='1.23.9'
  • 加载指定镜像
minikube image load registry.cn-hangzhou.aliyuncs.com/google_containers/nginx-ingress-controller:v1.2.1
minikube image load registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1
  • 指定自定义镜像
minikube addons enable ingress --images="KubeWebhookCertgenCreate=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1,KubeWebhookCertgenPatch=registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1,IngressController=google_containers/nginx-ingress-controller:v1.2.1" --registries="IngressController=registry.cn-hangzhou.aliyuncs.com"

* ingress is an addon maintained by Kubernetes. For any concerns contact minikube on GitHub.
You can view the list of minikube maintainers at: https://github.com/kubernetes/minikube/blob/master/OWNERS
  - Using image registry.cn-hangzhou.aliyuncs.com/google_containers/nginx-ingress-controller:v1.2.1
  - Using image registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1
  - Using image registry.cn-hangzhou.aliyuncs.com/google_containers/kube-webhook-certgen:v1.1.1
* Verifying ingress addon...
* The 'ingress' addon is enabled
  • 查看
kubectl -n ingress-nginx get pods
NAME                                        READY   STATUS      RESTARTS   AGE
ingress-nginx-admission-create-kzp9g        0/1     Completed   0          3h50m
ingress-nginx-admission-patch-vxpc4         0/1     Completed   0          3h50m
ingress-nginx-controller-69669855f6-l69ct   1/1     Running     0          3h50m