diff --git a/examples/customization/custom-vts-metrics/nginx/README.md b/examples/customization/custom-vts-metrics/nginx/README.md index ca65f3025..e8e678ecf 100644 --- a/examples/customization/custom-vts-metrics/nginx/README.md +++ b/examples/customization/custom-vts-metrics/nginx/README.md @@ -1,7 +1,11 @@ # Deploying the Nginx Ingress controller This example aims to demonstrate the deployment of an nginx ingress controller and -use a ConfigMap to enable nginx vts module and export metrics for prometheus. +use a ConfigMap to enable nginx vts module and export metrics for prometheus,to enable +vts metric,you can simply run `kubectl apply -f nginx`,a deployment and service will be +created which already has a `prometheus.io/scrap: 'true'` annotation and if you added +the recommended Prometheus service-endpoint scraping [configuration](https://raw.githubusercontent.com/prometheus/prometheus/master/documentation/examples/prometheus-kubernetes.yml), +Prometheus will scrape it automatically and you start using the generated metrics right away. ## Default Backend diff --git a/examples/customization/custom-vts-metrics/nginx/nginx-ingress-controller-service.yaml b/examples/customization/custom-vts-metrics/nginx/nginx-ingress-controller-service.yaml new file mode 100644 index 000000000..4d100425e --- /dev/null +++ b/examples/customization/custom-vts-metrics/nginx/nginx-ingress-controller-service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: nginx-ingress-controller-service + namespace: kube-system + labels: + k8s-app: nginx-ingress-controller-service + annotations: + prometheus.io/port: '10254' + prometheus.io/scrape: 'true' +spec: + ports: + - name: http-metrics + port: 8080 + targetPort: 10254 + protocol: TCP + selector: + k8s-app: nginx-ingress-controller