README.md.gotmpl 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. {{ 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. {{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }}
  4. To use, add `ingressClassName: nginx` spec field or the `kubernetes.io/ingress.class: nginx` annotation to your Ingress resources.
  5. This chart bootstraps an ingress-nginx deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
  6. ## Prerequisites
  7. - Chart version 3.x.x: Kubernetes v1.16+
  8. - Chart version 4.x.x and above: Kubernetes v1.19+
  9. ## Get Repo Info
  10. ```console
  11. helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
  12. helm repo update
  13. ```
  14. ## Install Chart
  15. **Important:** only helm3 is supported
  16. ```console
  17. helm install [RELEASE_NAME] ingress-nginx/ingress-nginx
  18. ```
  19. The command deploys ingress-nginx on the Kubernetes cluster in the default configuration.
  20. _See [configuration](#configuration) below._
  21. _See [helm install](https://helm.sh/docs/helm/helm_install/) for command documentation._
  22. ## Uninstall Chart
  23. ```console
  24. helm uninstall [RELEASE_NAME]
  25. ```
  26. This removes all the Kubernetes components associated with the chart and deletes the release.
  27. _See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command documentation._
  28. ## Upgrading Chart
  29. ```console
  30. helm upgrade [RELEASE_NAME] [CHART] --install
  31. ```
  32. _See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._
  33. ### Upgrading With Zero Downtime in Production
  34. By 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).
  35. ### Migrating from stable/nginx-ingress
  36. There are two main ways to migrate a release from `stable/nginx-ingress` to `ingress-nginx/ingress-nginx` chart:
  37. 1. 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
  38. 1. For critical services in production that require zero-downtime, you will want to:
  39. 1. [Install](#install-chart) a second Ingress controller
  40. 1. Redirect your DNS traffic from the old controller to the new controller
  41. 1. Log traffic from both controllers during this changeover
  42. 1. [Uninstall](#uninstall-chart) the old controller once traffic has fully drained from it
  43. 1. For details on all of these steps see [Upgrading With Zero Downtime in Production](#upgrading-with-zero-downtime-in-production)
  44. Note 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.
  45. ## Configuration
  46. See [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:
  47. ```console
  48. helm show values ingress-nginx/ingress-nginx
  49. ```
  50. ### PodDisruptionBudget
  51. Note that the PodDisruptionBudget resource will only be defined if the replicaCount is greater than one,
  52. else it would make it impossible to evacuate a node. See [gh issue #7127](https://github.com/helm/charts/issues/7127) for more info.
  53. ### Prometheus Metrics
  54. The Nginx ingress controller can export Prometheus metrics, by setting `controller.metrics.enabled` to `true`.
  55. You can add Prometheus annotations to the metrics service using `controller.metrics.service.annotations`.
  56. Alternatively, 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`)
  57. ### ingress-nginx nginx\_status page/stats server
  58. Previous versions of this chart had a `controller.stats.*` configuration block, which is now obsolete due to the following changes in nginx ingress controller:
  59. - In [0.16.1](https://github.com/kubernetes/ingress-nginx/blob/main/Changelog.md#0161), the vts (virtual host traffic status) dashboard was removed
  60. - 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.
  61. 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
  62. ### ExternalDNS Service Configuration
  63. Add an [ExternalDNS](https://github.com/kubernetes-incubator/external-dns) annotation to the LoadBalancer service:
  64. ```yaml
  65. controller:
  66. service:
  67. annotations:
  68. external-dns.alpha.kubernetes.io/hostname: kubernetes-example.com.
  69. ```
  70. ### AWS L7 ELB with SSL Termination
  71. Annotate the controller as shown in the [nginx-ingress l7 patch](https://github.com/kubernetes/ingress-nginx/blob/ab3a789caae65eec4ad6e3b46b19750b481b6bce/deploy/aws/l7/service-l7.yaml):
  72. ```yaml
  73. controller:
  74. service:
  75. targetPorts:
  76. http: http
  77. https: http
  78. annotations:
  79. service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:XX-XXXX-X:XXXXXXXXX:certificate/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX
  80. service.beta.kubernetes.io/aws-load-balancer-backend-protocol: "http"
  81. service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
  82. service.beta.kubernetes.io/aws-load-balancer-connection-idle-timeout: '3600'
  83. ```
  84. ### AWS route53-mapper
  85. To configure the LoadBalancer service with the [route53-mapper addon](https://github.com/kubernetes/kops/blob/be63d4f1a7a46daaf1c4c482527328236850f111/addons/route53-mapper/README.md), add the `domainName` annotation and `dns` label:
  86. ```yaml
  87. controller:
  88. service:
  89. labels:
  90. dns: "route53"
  91. annotations:
  92. domainName: "kubernetes-example.com"
  93. ```
  94. ### Additional Internal Load Balancer
  95. This 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.
  96. By 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.
  97. You'll need to set both the following values:
  98. `controller.service.internal.enabled`
  99. `controller.service.internal.annotations`
  100. If 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.
  101. `controller.service.internal.annotations` varies with the cloud service you're using.
  102. Example for AWS:
  103. ```yaml
  104. controller:
  105. service:
  106. internal:
  107. enabled: true
  108. annotations:
  109. # Create internal ELB
  110. service.beta.kubernetes.io/aws-load-balancer-internal: "true"
  111. # Any other annotation can be declared here.
  112. ```
  113. Example for GCE:
  114. ```yaml
  115. controller:
  116. service:
  117. internal:
  118. enabled: true
  119. annotations:
  120. # Create internal LB. More informations: https://cloud.google.com/kubernetes-engine/docs/how-to/internal-load-balancing
  121. # For GKE versions 1.17 and later
  122. networking.gke.io/load-balancer-type: "Internal"
  123. # For earlier versions
  124. # cloud.google.com/load-balancer-type: "Internal"
  125. # Any other annotation can be declared here.
  126. ```
  127. Example for Azure:
  128. ```yaml
  129. controller:
  130. service:
  131. annotations:
  132. # Create internal LB
  133. service.beta.kubernetes.io/azure-load-balancer-internal: "true"
  134. # Any other annotation can be declared here.
  135. ```
  136. Example for Oracle Cloud Infrastructure:
  137. ```yaml
  138. controller:
  139. service:
  140. annotations:
  141. # Create internal LB
  142. service.beta.kubernetes.io/oci-load-balancer-internal: "true"
  143. # Any other annotation can be declared here.
  144. ```
  145. An 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.
  146. Optionally you can set `controller.service.loadBalancerIP` if you need a static IP for the resulting `LoadBalancer`.
  147. ### Ingress Admission Webhooks
  148. With 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.
  149. **This feature is enabled by default since 0.31.0.**
  150. With 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)
  151. ### Helm Error When Upgrading: spec.clusterIP: Invalid value: ""
  152. If you are upgrading this chart from a version between 0.31.0 and 1.2.2 then you may get an error like this:
  153. ```console
  154. Error: UPGRADE FAILED: Service "?????-controller" is invalid: spec.clusterIP: Invalid value: "": field is immutable
  155. ```
  156. Detail 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.
  157. As 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.
  158. {{ template "chart.requirementsSection" . }}
  159. {{ template "chart.valuesSection" . }}
  160. {{ template "helm-docs.versionFooter" . }}