** Please be patient while the chart is being deployed ** NGINX can be accessed through the following DNS name from within your cluster:
my-nginx.default.svc.cluster.local (port 80)
To access NGINX from outside the cluster, follow the steps below:
1. Get the NGINX URL by running these commands:
NOTE: It may take a few minutes for the LoadBalancer IP to be available. Watch the status with: 'kubectl get svc --namespace default -w my-nginx'
export SERVICE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].port}" services my-nginx) export SERVICE_IP=$(kubectl get svc --namespace default my-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}') echo"http://${SERVICE_IP}:${SERVICE_PORT}"
稍等片刻,nginx就安装好了,我们可以使用kubectl来验证:
1
kubectl get pod
输出类似于:
1 2
NAME READY STATUS RESTARTS AGE my-nginx-57b598754b-h5hlb 1/1 Running 0 2m43s
因为使用的是minikube,需要输入minikube service my-nginx将在浏览器中自动打开my-nginx应用程序。 成功请求的响应会在浏览器页面展示:
1
minikube service nginx-form
输出类似于:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
minikube service my-nginx |-----------|----------|-------------|---------------------------| | NAMESPACE | NAME | TARGET PORT | URL | |-----------|----------|-------------|---------------------------| | default | my-nginx | http/80 | http://192.168.49.2:30189 | |-----------|----------|-------------|---------------------------| 🏃 Starting tunnel for service my-nginx. |-----------|----------|-------------|------------------------| | NAMESPACE | NAME | TARGET PORT | URL | |-----------|----------|-------------|------------------------| | default | my-nginx | | http://127.0.0.1:56969 | |-----------|----------|-------------|------------------------| 🎉 正通过默认浏览器打开服务 default/my-nginx... ❗ Because you are using a Docker driver on darwin, the terminal needs to be open to run it.