记得先使用 minikube delete --all --purge
删除已有的 minikube 容器
使用 aliyun 镜像就好了
minikube start --driver=docker --kubernetes-version=v1.23.9 --image-mirror-country cn --registry-mirror=https://hz4anb2p.mirror.aliyuncs.com
如何获取 docker aliyun 官方镜像加速可参考:官方镜像加速
完成输出如下:
─➤ minikube start --driver=docker --kubernetes-version=v1.23.9 --image-mirror-country cn --registry-mirror=https://hz4anb2p.mirror.aliyuncs.com
Ubuntu 22.04 上的 minikube v1.28.0
✨ 根据用户配置使用 docker 驱动程序
✅ 正在使用镜像存储库 registry.cn-hangzhou.aliyuncs.com/google_containers
Using Docker driver with root privileges
Starting control plane node minikube in cluster minikube
Pulling base image ...
> registry.cn-hangzhou.aliyun...: 386.27 MiB / 386.27 MiB 100.00% 6.29 Mi
> registry.cn-hangzhou.aliyun...: 0 B [_____________________] ?% ? p/s 40s
Creating docker container (CPUs=2, Memory=6900MB) ...
> kubelet.sha256: 64 B / 64 B [-------------------------] 100.00% ? p/s 0s
> kubectl.sha256: 64 B / 64 B [-------------------------] 100.00% ? p/s 0s
> kubeadm.sha256: 64 B / 64 B [-------------------------] 100.00% ? p/s 0s
> kubeadm: 43.13 MiB / 43.13 MiB [-------------] 100.00% 5.93 MiB p/s 7.5s
> kubectl: 44.44 MiB / 44.44 MiB [--------------] 100.00% 4.17 MiB p/s 11s
> kubelet: 118.43 MiB / 118.43 MiB [------------] 100.00% 6.22 MiB p/s 19s
▪ Generating certificates and keys ...
▪ Booting up control plane ...
▪ Configuring RBAC rules ...
Verifying Kubernetes components...
▪ Using image registry.cn-hangzhou.aliyuncs.com/google_containers/storage-provisioner:v5
Enabled addons: storage-provisioner, default-storageclass
Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
这个时候在启动 ingress 就无比顺畅了
╰─➤ minikube addons enable ingress
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...
启动 'ingress' 插件
但是状态是 Completed,至少不是 ImagePullBackOff
╰─➤ kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
default balanced-5f95856476-wvsw5 1/1 Running 0 17m
default bar-app 1/1 Running 0 18m
default foo-app 1/1 Running 0 18m
default hello-minikube-fdf664d87-tvd65 1/1 Running 0 17m
ingress-nginx ingress-nginx-admission-create-w6mws 0/1 Completed 0 20m
ingress-nginx ingress-nginx-admission-patch-9xz4k 0/1 Completed 1 20m
ingress-nginx ingress-nginx-controller-647bbc75dd-7zhcg 1/1 Running 0 20m
kube-system coredns-65c54cc984-vt4sw 1/1 Running 0 30m
kube-system etcd-minikube 1/1 Running 0 31m
kube-system kube-apiserver-minikube 1/1 Running 0 31m
kube-system kube-controller-manager-minikube 1/1 Running 0 31m
kube-system kube-proxy-9kg27 1/1 Running 0 30m
kube-system kube-scheduler-minikube 1/1 Running 0 31m
kube-system storage-provisioner 1/1 Running 1 (30m ago) 31m