一、Nginx简介
Nginx是一个常见的Web容器,也能做负载均衡器、反向代理工具,本文只讲述其作为Web容器的使用方式。
二、安装Metrics Server
使用Helm安装
helm repo add bitnami https://charts.bitnami.com/bitnami
helm install nginx bitnami/nginx -n test
部署完成,控制台打印:
NAME: nginx
LAST DEPLOYED: Sun Nov 1 21:28:17 2020
NAMESPACE: test
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **
NGINX can be accessed through the following DNS name from within your cluster:
nginx.test.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 test -w nginx'
export SERVICE_PORT=$(kubectl get --namespace test -o jsonpath="{.spec.ports[0].port}" services nginx)
export SERVICE_IP=$(kubectl get svc --namespace test nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "http://${SERVICE_IP}:${SERVICE_PORT}"