blob: 5cd9e59e194767b24a5de5f9f0d4cf7b6822c666 [file] [log] [blame]
Mohammed Naser9ad0d462023-01-15 20:36:37 -05001{{ template "chart.header" . }}
2[ingress-nginx](https://github.com/kubernetes/ingress-nginx) Ingress controller for Kubernetes using NGINX as a reverse proxy and load balancer
3
4{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
5
6To use, add `ingressClassName: nginx` spec field or the `kubernetes.io/ingress.class: nginx` annotation to your Ingress resources.
7
8This chart bootstraps an ingress-nginx deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
9
10## Prerequisites
11
12- Chart version 3.x.x: Kubernetes v1.16+
13- Chart version 4.x.x and above: Kubernetes v1.19+
14
15## Get Repo Info
16
17```console
18helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
19helm repo update
20```
21
22## Install Chart
23
24**Important:** only helm3 is supported
25
26```console
27helm install [RELEASE_NAME] ingress-nginx/ingress-nginx
28```
29
30The command deploys ingress-nginx on the Kubernetes cluster in the default configuration.
31
32_See [configuration](#configuration) below._
33
34_See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._
35
36## Uninstall Chart
37
38```console
39helm uninstall [RELEASE_NAME]
40```
41
42This removes all the Kubernetes components associated with the chart and deletes the release.
43
44_See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._
45
46## Upgrading Chart
47
48```console
49helm upgrade [RELEASE_NAME] [CHART] --install
50```
51
52_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._
53
54### Upgrading With Zero Downtime in Production
55
56By default the ingress-nginx controller has service interruptions whenever it's pods are restarted or redeployed. In order to fix that, see the excellent blog post by Lindsay Landry from Codecademy: [Kubernetes: Nginx and Zero Downtime in Production](https://medium.com/codecademy-engineering/kubernetes-nginx-and-zero-downtime-in-production-2c910c6a5ed8).
57
58### Migrating from stable/nginx-ingress
59
60There are two main ways to migrate a release from `stable/nginx-ingress` to `ingress-nginx/ingress-nginx` chart:
61
621. For Nginx Ingress controllers used for non-critical services, the easiest method is to [uninstall](#uninstall-chart) the old release and [install](#install-chart) the new one
631. For critical services in production that require zero-downtime, you will want to:
64 1. [Install](#install-chart) a second Ingress controller
65 1. Redirect your DNS traffic from the old controller to the new controller
66 1. Log traffic from both controllers during this changeover
67 1. [Uninstall](#uninstall-chart) the old controller once traffic has fully drained from it
68 1. For details on all of these steps see [Upgrading With Zero Downtime in Production](#upgrading-with-zero-downtime-in-production)
69
70Note that there are some different and upgraded configurations between the two charts, described by Rimas Mocevicius from JFrog in the "Upgrading to ingress-nginx Helm chart" section of [Migrating from Helm chart nginx-ingress to ingress-nginx](https://rimusz.net/migrating-to-ingress-nginx). As the `ingress-nginx/ingress-nginx` chart continues to update, you will want to check current differences by running [helm configuration](#configuration) commands on both charts.
71
72## Configuration
73
74See [Customizing the Chart Before Installing](https://helm.sh/docs/intro/using_helm/#customizing-the-chart-before-installing). To see all configurable options with detailed comments, visit the chart's [values.yaml](./values.yaml), or run these configuration commands:
75
76```console
77helm show values ingress-nginx/ingress-nginx
78```
79
80### PodDisruptionBudget
81
82Note that the PodDisruptionBudget resource will only be defined if the replicaCount is greater than one,
83else it would make it impossible to evacuate a node. See [gh issue #7127](https://github.com/helm/charts/issues/7127) for more info.
84
85### Prometheus Metrics
86
87The Nginx ingress controller can export Prometheus metrics, by setting `controller.metrics.enabled` to `true`.
88
89You can add Prometheus annotations to the metrics service using `controller.metrics.service.annotations`.
90Alternatively, if you use the Prometheus Operator, you can enable ServiceMonitor creation using `controller.metrics.serviceMonitor.enabled`. And set `controller.metrics.serviceMonitor.additionalLabels.release="prometheus"`. "release=prometheus" should match the label configured in the prometheus servicemonitor ( see `kubectl get servicemonitor prometheus-kube-prom-prometheus -oyaml -n prometheus`)
91
92### ingress-nginx nginx\_status page/stats server
93
94Previous versions of this chart had a `controller.stats.*` configuration block, which is now obsolete due to the following changes in nginx ingress controller:
95
96- In [0.16.1](https://github.com/kubernetes/ingress-nginx/blob/main/Changelog.md#0161), the vts (virtual host traffic status) dashboard was removed
97- In [0.23.0](https://github.com/kubernetes/ingress-nginx/blob/main/Changelog.md#0230), the status page at port 18080 is now a unix socket webserver only available at localhost.
98 You can use `curl --unix-socket /tmp/nginx-status-server.sock http://localhost/nginx_status` inside the controller container to access it locally, or use the snippet from [nginx-ingress changelog](https://github.com/kubernetes/ingress-nginx/blob/main/Changelog.md#0230) to re-enable the http server
99
100### ExternalDNS Service Configuration
101
102Add an [ExternalDNS](https://github.com/kubernetes-incubator/external-dns) annotation to the LoadBalancer service:
103
104```yaml
105controller:
106 service:
107 annotations:
108 external-dns.alpha.kubernetes.io/hostname: kubernetes-example.com.
109```
110
111### AWS L7 ELB with SSL Termination
112
113Annotate the controller as shown in the [nginx-ingress l7 patch](https://github.com/kubernetes/ingress-nginx/blob/main/deploy/aws/l7/service-l7.yaml):
114
115```yaml
116controller:
117 service:
118 targetPorts:
119 http: http
120 https: http
121 annotations:
122 service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:XX-XXXX-X:XXXXXXXXX:certificate/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX
123 service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "http"
124 service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
125 service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: '3600'
126```
127
128### AWS route53-mapper
129
130To configure the LoadBalancer service with the [route53-mapper addon](https://github.com/kubernetes/kops/tree/master/addons/route53-mapper), add the `domainName` annotation and `dns` label:
131
132```yaml
133controller:
134 service:
135 labels:
136 dns: "route53"
137 annotations:
138 domainName: "kubernetes-example.com"
139```
140
141### Additional Internal Load Balancer
142
143This setup is useful when you need both external and internal load balancers but don't want to have multiple ingress controllers and multiple ingress objects per application.
144
145By default, the ingress object will point to the external load balancer address, but if correctly configured, you can make use of the internal one if the URL you are looking up resolves to the internal load balancer's URL.
146
147You'll need to set both the following values:
148
149`controller.service.internal.enabled`
150`controller.service.internal.annotations`
151
152If one of them is missing the internal load balancer will not be deployed. Example you may have `controller.service.internal.enabled=true` but no annotations set, in this case no action will be taken.
153
154`controller.service.internal.annotations` varies with the cloud service you're using.
155
156Example for AWS:
157
158```yaml
159controller:
160 service:
161 internal:
162 enabled: true
163 annotations:
164 # Create internal ELB
165 service.beta.kubernetes.io/aws-load-balancer-internal: "true"
166 # Any other annotation can be declared here.
167```
168
169Example for GCE:
170
171```yaml
172controller:
173 service:
174 internal:
175 enabled: true
176 annotations:
177 # Create internal LB. More informations: https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balancing
178 # For GKE versions 1.17 and later
179 networking.gke.io/load-balancer-type: "Internal"
180 # For earlier versions
181 # cloud.google.com/load-balancer-type: "Internal"
182
183 # Any other annotation can be declared here.
184```
185
186Example for Azure:
187
188```yaml
189controller:
190 service:
191 annotations:
192 # Create internal LB
193 service.beta.kubernetes.io/azure-load-balancer-internal: "true"
194 # Any other annotation can be declared here.
195```
196
197Example for Oracle Cloud Infrastructure:
198
199```yaml
200controller:
201 service:
202 annotations:
203 # Create internal LB
204 service.beta.kubernetes.io/oci-load-balancer-internal: "true"
205 # Any other annotation can be declared here.
206```
207
208An use case for this scenario is having a split-view DNS setup where the public zone CNAME records point to the external balancer URL while the private zone CNAME records point to the internal balancer URL. This way, you only need one ingress kubernetes object.
209
210Optionally you can set `controller.service.loadBalancerIP` if you need a static IP for the resulting `LoadBalancer`.
211
212### Ingress Admission Webhooks
213
214With nginx-ingress-controller version 0.25+, the nginx ingress controller pod exposes an endpoint that will integrate with the `validatingwebhookconfiguration` Kubernetes feature to prevent bad ingress from being added to the cluster.
215**This feature is enabled by default since 0.31.0.**
216
217With nginx-ingress-controller in 0.25.* work only with kubernetes 1.14+, 0.26 fix [this issue](https://github.com/kubernetes/ingress-nginx/pull/4521)
218
219### Helm Error When Upgrading: spec.clusterIP: Invalid value: ""
220
221If you are upgrading this chart from a version between 0.31.0 and 1.2.2 then you may get an error like this:
222
223```console
224Error: UPGRADE FAILED: Service "?????-controller" is invalid: spec.clusterIP: Invalid value: "": field is immutable
225```
226
227Detail of how and why are in [this issue](https://github.com/helm/charts/pull/13646) but to resolve this you can set `xxxx.service.omitClusterIP` to `true` where `xxxx` is the service referenced in the error.
228
229As of version `1.26.0` of this chart, by simply not providing any clusterIP value, `invalid: spec.clusterIP: Invalid value: "": field is immutable` will no longer occur since `clusterIP: ""` will not be rendered.
230
231{{ template "chart.requirementsSection" . }}
232
233{{ template "chart.valuesSection" . }}
234
235{{ template "helm-docs.versionFooter" . }}