From 5eda92b1c9879daf6cd0f567db09c537a1c890ed Mon Sep 17 00:00:00 2001 From: Alan J Castonguay Date: Mon, 13 May 2019 17:50:59 -0400 Subject: [PATCH] Explain references in custom-headers documentation Augment description of custom-headers behavior. Explain the purpose of the two configmaps, making explicit that one cites the other by `namespace/name`. Link the two example yaml files, so they're more easily navigated to from a browser looking at https://kubernetes.github.io/ingress-nginx/examples/customization/custom-headers/ Campfire: grammar, standard installation is in the `ingress-nginx` namespace. --- .../customization/custom-headers/README.md | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/docs/examples/customization/custom-headers/README.md b/docs/examples/customization/custom-headers/README.md index b5e4c6022..7551abda3 100644 --- a/docs/examples/customization/custom-headers/README.md +++ b/docs/examples/customization/custom-headers/README.md @@ -1,19 +1,24 @@ # Custom Headers -This example aims to demonstrate the deployment of an nginx ingress controller and -use a ConfigMap to configure a custom list of headers to be passed to the upstream -server +This example demonstrates configuration of the nginx ingress controller via +a ConfigMap to pass a custom list of headers to the upstream +server. + +[custom-headers.yaml](custom-headers.yaml) defines a ConfigMap in the `ingress-nginx` namespace named `custom-headers`, holding several custom X-prefixed HTTP headers. ```console -curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/customization/custom-headers/configmap.yaml \ - | kubectl apply -f - - -curl https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/customization/custom-headers/custom-headers.yaml \ - | kubectl apply -f - - +kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/customization/custom-headers/custom-headers.yaml ``` +[configmap.yaml](configmap.yaml) defines a ConfigMap in the `ingress-nginx` namespace named `nginx-configuration`. This controls the [global configuration](../../../user-guide/nginx-configuration/configmap.md) of the ingress controller, and already exists in a standard installation. The key `proxy-set-headers` is set to cite the previously-created `ingress-nginx/custom-headers` ConfigMap. + +```console +kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/docs/examples/customization/custom-headers/configmap.yaml +``` + +The nginx ingress controller will read the `ingress-nginx/nginx-configuration` ConfigMap, find the `proxy-set-headers` key, read HTTP headers from the `ingress-nginx/custom-headers` ConfigMap, and include those HTTP headers in all requests flowing from nginx to the backends. + ## Test -Check the contents of the configmap is present in the nginx.conf file using: -`kubectl exec nginx-ingress-controller-873061567-4n3k2 -n kube-system cat /etc/nginx/nginx.conf` +Check the contents of the ConfigMaps are present in the nginx.conf file using: +`kubectl exec nginx-ingress-controller-873061567-4n3k2 -n ingress-nginx cat /etc/nginx/nginx.conf`