minikube安装—https://minikube.sigs.k8s.io/docs/start/
minikube安装好慢—https://blog.csdn.net/u010953609/article/details/121536434
To install the latest minikube stable release on x86-64 Linux using binary download:
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
sudo install minikube-linux-amd64 /usr/local/bin/minikube
每次都要拉镜像来启动minikube
minikube start
minikube start --image-mirror-country=cn
alias kubectl="minikube kubectl --"
minikube kubectl -- get po -A
kubectl get pods -A
minikube dashboard
season@ZHS-190213650:~$ minikube dashboard
🔌 Enabling dashboard ...
▪ Using image registry.cn-hangzhou.aliyuncs.com/google_containers/dashboard:v2.6.0
▪ Using image registry.cn-hangzhou.aliyuncs.com/google_containers/metrics-scraper:v1.0.8
🤔 Verifying dashboard health ...
🚀 Launching proxy ...
🤔 Verifying proxy health ...
🎉 Opening http://127.0.0.1:40649/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/ in your default browser...
👉 http://127.0.0.1:40649/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/
创建一个示例部署并在端口 8080 上公开它:
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment hello-minikube --type=NodePort --port=8080
这可能需要一点时间,但是当您运行时,您的部署将很快出现:
kubectl get services hello-minikube
访问此服务的最简单方法是让 minikube 为您启动 Web 浏览器:
minikube service hello-minikube
或者,使用 kubectl 转发端口:
kubectl port-forward service/hello-minikube 7080:8080
您的应用程序现在可以在http://localhost:7080/获得。您应该能够在应用程序输出中看到来自 nginx 的请求元数据,例如CLIENT VALUES。
要访问 LoadBalancer 部署,请使用“minikube tunnel”命令。这是一个示例部署:
kubectl create deployment balanced --image=k8s.gcr.io/echoserver:1.4
kubectl expose deployment balanced --type=LoadBalancer --port=8080
在另一个窗口中,启动隧道以为“平衡”部署创建可路由 IP:
minikube tunnel
要查找可路由 IP,请运行此命令并检查该EXTERNAL-IP列:
kubectl get services balanced
您的部署现在在 < EXTERNAL-IP >:8080 可用
season@ZHS-190213650:~$ kubectl create deployment balanced --image=k8s.gcr.io/echoserver:1.4
deployment.apps/balanced created
season@ZHS-190213650:~$ kubectl expose deployment balanced --type=LoadBalancer --port=8080
service/balanced exposed
season@ZHS-190213650:~$ minikube tunnel
✅ Tunnel successfully started
📌 NOTE: Please do not close this terminal as this process must stay alive for the tunnel to be accessible ...
🏃 Starting tunnel for service balanced.
minikube cache add redis:alpine
~$ minikube cache add redis:alpine
❗ "minikube cache" will be deprecated in upcoming versions, please switch to "minikube image load"