diff --git a/404.html b/404.html index 7e2565239..f51a19f89 100644 --- a/404.html +++ b/404.html @@ -794,6 +794,19 @@ + + + + + + +
  • + + OpenTelemetry + +
  • + + diff --git a/deploy/baremetal/index.html b/deploy/baremetal/index.html index 67dfc5dcf..c530d46f6 100644 --- a/deploy/baremetal/index.html +++ b/deploy/baremetal/index.html @@ -1,4 +1,4 @@ - Bare-metal considerations - NGINX Ingress Controller
    Skip to content

    Bare-metal considerations

    In traditional cloud environments, where network load balancers are available on-demand, a single Kubernetes manifest suffices to provide a single point of contact to the NGINX Ingress controller to external clients and, indirectly, to any application running inside the cluster. Bare-metal environments lack this commodity, requiring a slightly different setup to offer the same kind of access to external consumers.

    Cloud environment Bare-metal environment

    The rest of this document describes a few recommended approaches to deploying the NGINX Ingress controller inside a Kubernetes cluster running on bare-metal.

    A pure software solution: MetalLB

    MetalLB provides a network load-balancer implementation for Kubernetes clusters that do not run on a supported cloud provider, effectively allowing the usage of LoadBalancer Services within any cluster.

    This section demonstrates how to use the Layer 2 configuration mode of MetalLB together with the NGINX Ingress controller in a Kubernetes cluster that has publicly accessible nodes. In this mode, one node attracts all the traffic for the ingress-nginx Service IP. See Traffic policies for more details.

    MetalLB in L2 mode

    Note

    The description of other supported configuration modes is off-scope for this document.

    Warning

    MetalLB is currently in beta. Read about the Project maturity and make sure you inform yourself by reading the official documentation thoroughly.

    MetalLB can be deployed either with a simple Kubernetes manifest or with Helm. The rest of this example assumes MetalLB was deployed following the Installation instructions, and that the NGINX Ingress controller was installed using the steps described in the quickstart section of the installation guide.

    MetalLB requires a pool of IP addresses in order to be able to take ownership of the ingress-nginx Service. This pool can be defined through IPAddressPool objects in the same namespace as the MetalLB controller. This pool of IPs must be dedicated to MetalLB's use, you can't reuse the Kubernetes node IPs or IPs handed out by a DHCP server.

    Example

    Given the following 3-node Kubernetes cluster (the external IP is added as an example, in most bare-metal environments this value is <None>)

    $ kubectl get node
    + Bare-metal considerations - NGINX Ingress Controller      

    Bare-metal considerations

    In traditional cloud environments, where network load balancers are available on-demand, a single Kubernetes manifest suffices to provide a single point of contact to the NGINX Ingress controller to external clients and, indirectly, to any application running inside the cluster. Bare-metal environments lack this commodity, requiring a slightly different setup to offer the same kind of access to external consumers.

    Cloud environment Bare-metal environment

    The rest of this document describes a few recommended approaches to deploying the NGINX Ingress controller inside a Kubernetes cluster running on bare-metal.

    A pure software solution: MetalLB

    MetalLB provides a network load-balancer implementation for Kubernetes clusters that do not run on a supported cloud provider, effectively allowing the usage of LoadBalancer Services within any cluster.

    This section demonstrates how to use the Layer 2 configuration mode of MetalLB together with the NGINX Ingress controller in a Kubernetes cluster that has publicly accessible nodes. In this mode, one node attracts all the traffic for the ingress-nginx Service IP. See Traffic policies for more details.

    MetalLB in L2 mode

    Note

    The description of other supported configuration modes is off-scope for this document.

    Warning

    MetalLB is currently in beta. Read about the Project maturity and make sure you inform yourself by reading the official documentation thoroughly.

    MetalLB can be deployed either with a simple Kubernetes manifest or with Helm. The rest of this example assumes MetalLB was deployed following the Installation instructions, and that the NGINX Ingress controller was installed using the steps described in the quickstart section of the installation guide.

    MetalLB requires a pool of IP addresses in order to be able to take ownership of the ingress-nginx Service. This pool can be defined through IPAddressPool objects in the same namespace as the MetalLB controller. This pool of IPs must be dedicated to MetalLB's use, you can't reuse the Kubernetes node IPs or IPs handed out by a DHCP server.

    Example

    Given the following 3-node Kubernetes cluster (the external IP is added as an example, in most bare-metal environments this value is <None>)

    $ kubectl get node
     NAME     STATUS   ROLES    EXTERNAL-IP
     host-1   Ready    master   203.0.113.1
     host-2   Ready    node     203.0.113.2
    diff --git a/deploy/hardening-guide/index.html b/deploy/hardening-guide/index.html
    index 4acfca382..e3f0a0e16 100644
    --- a/deploy/hardening-guide/index.html
    +++ b/deploy/hardening-guide/index.html
    @@ -1,4 +1,4 @@
    - Hardening guide - NGINX Ingress Controller      

    Hardening Guide

    Overview

    There are several ways to do hardening and securing of nginx. In this documentation two guides are used, the guides are overlapping in some points:

    This guide describes, what of the different configurations described in those guides is already implemented as default in the nginx implementation of kubernetes ingress, what needs to be configured, what is obsolete due to the fact that the nginx is running as container (the CIS benchmark relates to a non-containerized installation) and what is difficult or not possible.

    Be aware that this is only a guide and you are responsible for your own implementation. Some of the configurations may lead to have specific clients unable to reach your site or similar consequences.

    This guide refers to chapters in the CIS Benchmark. For full explanation you should refer to the benchmark document itself

    Configuration Guide

    Chapter in CIS benchmark Status Default Action to do if not default
    1 Initial Setup
    1.1 Installation
    1.1.1 Ensure NGINX is installed (Scored) OK done through helm charts / following documentation to deploy nginx ingress
    1.1.2 Ensure NGINX is installed from source (Not Scored) OK done through helm charts / following documentation to deploy nginx ingress
    1.2 Configure Software Updates
    1.2.1 Ensure package manager repositories are properly configured (Not Scored) OK done via helm, nginx version could be overwritten, however compatibility is not ensured then
    1.2.2 Ensure the latest software package is installed (Not Scored) ACTION NEEDED done via helm, nginx version could be overwritten, however compatibility is not ensured then Plan for periodic updates
    2 Basic Configuration
    2.1 Minimize NGINX Modules
    2.1.1 Ensure only required modules are installed (Not Scored) OK Already only needed modules are installed, however proposals for further reduction are welcome
    2.1.2 Ensure HTTP WebDAV module is not installed (Scored) OK
    2.1.3 Ensure modules with gzip functionality are disabled (Scored) OK
    2.1.4 Ensure the autoindex module is disabled (Scored) OK No autoindex configs so far in ingress defaults
    2.2 Account Security
    2.2.1 Ensure that NGINX is run using a non-privileged, dedicated service account (Not Scored) OK Pod configured as user www-data: See this line in helm chart values. Compiled with user www-data: See this line in build script
    2.2.2 Ensure the NGINX service account is locked (Scored) OK Docker design ensures this
    2.2.3 Ensure the NGINX service account has an invalid shell (Scored) OK Shell is nologin: see this line in build script
    2.3 Permissions and Ownership
    2.3.1 Ensure NGINX directories and files are owned by root (Scored) OK Obsolete through docker-design and ingress controller needs to update the configs dynamically
    2.3.2 Ensure access to NGINX directories and files is restricted (Scored) OK See previous answer
    2.3.3 Ensure the NGINX process ID (PID) file is secured (Scored) OK No PID-File due to docker design
    2.3.4 Ensure the core dump directory is secured (Not Scored) OK No working_directory configured by default
    2.4 Network Configuration
    2.4.1 Ensure NGINX only listens for network connections on authorized ports (Not Scored) OK Ensured by automatic nginx.conf configuration
    2.4.2 Ensure requests for unknown host names are rejected (Not Scored) OK They are not rejected but send to the "default backend" delivering appropriate errors (mostly 404)
    2.4.3 Ensure keepalive_timeout is 10 seconds or less, but not 0 (Scored) ACTION NEEDED Default is 75s configure keep-alive to 10 seconds according to this documentation
    2.4.4 Ensure send_timeout is set to 10 seconds or less, but not 0 (Scored) RISK TO BE ACCEPTED Not configured, however the nginx default is 60s Not configurable
    2.5 Information Disclosure
    2.5.1 Ensure server_tokens directive is set to off (Scored) OK server_tokens is configured to off by default
    2.5.2 Ensure default error and index.html pages do not reference NGINX (Scored) ACTION NEEDED 404 shows no version at all, 503 and 403 show "nginx", which is hardcoded see this line in nginx source code configure custom error pages at least for 403, 404 and 503 and 500
    2.5.3 Ensure hidden file serving is disabled (Not Scored) ACTION NEEDED config not set configure a config.server-snippet Snippet, but beware of .well-known challenges or similar. Refer to the benchmark here please
    2.5.4 Ensure the NGINX reverse proxy does not enable information disclosure (Scored) ACTION NEEDED hide not configured configure hide-headers with array of "X-Powered-By" and "Server": according to this documentation
    3 Logging
    3.1 Ensure detailed logging is enabled (Not Scored) OK nginx ingress has a very detailed log format by default
    3.2 Ensure access logging is enabled (Scored) OK Access log is enabled by default
    3.3 Ensure error logging is enabled and set to the info logging level (Scored) OK Error log is configured by default. The log level does not matter, because it is all sent to STDOUT anyway
    3.4 Ensure log files are rotated (Scored) OBSOLETE Log file handling is not part of the nginx ingress and should be handled separately
    3.5 Ensure error logs are sent to a remote syslog server (Not Scored) OBSOLETE See previous answer
    3.6 Ensure access logs are sent to a remote syslog server (Not Scored) OBSOLETE See previous answer
    3.7 Ensure proxies pass source IP information (Scored) OK Headers are set by default
    4 Encryption
    4.1 TLS / SSL Configuration
    4.1.1 Ensure HTTP is redirected to HTTPS (Scored) OK Redirect to TLS is default
    4.1.2 Ensure a trusted certificate and trust chain is installed (Not Scored) ACTION NEEDED For installing certs there are enough manuals in the web. A good way is to use lets encrypt through cert-manager Install proper certificates or use lets encrypt with cert-manager
    4.1.3 Ensure private key permissions are restricted (Scored) ACTION NEEDED See previous answer
    4.1.4 Ensure only modern TLS protocols are used (Scored) OK/ACTION NEEDED Default is TLS 1.2 + 1.3, while this is okay for CIS Benchmark, cipherlist.eu only recommends 1.3. This may cut off old OS's Set controller.config.ssl-protocols to "TLSv1.3"
    4.1.5 Disable weak ciphers (Scored) ACTION NEEDED Default ciphers are already good, but cipherlist.eu recommends even stronger ciphers Set controller.config.ssl-ciphers to "EECDH+AESGCM:EDH+AESGCM"
    4.1.6 Ensure custom Diffie-Hellman parameters are used (Scored) ACTION NEEDED No custom DH parameters are generated Generate dh parameters for each ingress deployment you use - see here for a how to
    4.1.7 Ensure Online Certificate Status Protocol (OCSP) stapling is enabled (Scored) ACTION NEEDED Not enabled set via this configuration parameter
    4.1.8 Ensure HTTP Strict Transport Security (HSTS) is enabled (Scored) OK HSTS is enabled by default
    4.1.9 Ensure HTTP Public Key Pinning is enabled (Not Scored) ACTION NEEDED / RISK TO BE ACCEPTED HKPK not enabled by default If lets encrypt is not used, set correct HPKP header. There are several ways to implement this - with the helm charts it works via controller.add-headers. If lets encrypt is used, this is complicated, a solution here is yet unknown
    4.1.10 Ensure upstream server traffic is authenticated with a client certificate (Scored) DEPENDS ON BACKEND Highly dependent on backends, not every backend allows configuring this, can also be mitigated via a service mesh If backend allows it, manual is here
    4.1.11 Ensure the upstream traffic server certificate is trusted (Not Scored) DEPENDS ON BACKEND Highly dependent on backends, not every backend allows configuring this, can also be mitigated via a service mesh If backend allows it, see configuration here
    4.1.12 Ensure your domain is preloaded (Not Scored) ACTION NEEDED Preload is not active by default Set controller.config.hsts-preload to true
    4.1.13 Ensure session resumption is disabled to enable perfect forward security (Scored) OK Session tickets are disabled by default
    4.1.14 Ensure HTTP/2.0 is used (Not Scored) OK http2 is set by default
    5 Request Filtering and Restrictions
    5.1 Access Control
    5.1.1 Ensure allow and deny filters limit access to specific IP addresses (Not Scored) OK/ACTION NEEDED Depends on use case, geo ip module is compiled into nginx ingress controller, there are several ways to use it If needed set IP restrictions via annotations or work with config snippets (be careful with lets-encrypt-http-challenge!)
    5.1.2 Ensure only whitelisted HTTP methods are allowed (Not Scored) OK/ACTION NEEDED Depends on use case If required it can be set via config snippet
    5.2 Request Limits
    5.2.1 Ensure timeout values for reading the client header and body are set correctly (Scored) ACTION NEEDED Default timeout is 60s Set via this configuration parameter and respective body equivalent
    5.2.2 Ensure the maximum request body size is set correctly (Scored) ACTION NEEDED Default is 1m set via this configuration parameter
    5.2.3 Ensure the maximum buffer size for URIs is defined (Scored) ACTION NEEDED Default is 4 8k Set via this configuration parameter
    5.2.4 Ensure the number of connections per IP address is limited (Not Scored) OK/ACTION NEEDED No limit set Depends on use case, limit can be set via these annotations
    5.2.5 Ensure rate limits by IP address are set (Not Scored) OK/ACTION NEEDED No limit set Depends on use case, limit can be set via these annotations
    5.3 Browser Security
    5.3.1 Ensure X-Frame-Options header is configured and enabled (Scored) ACTION NEEDED Header not set by default Several ways to implement this - with the helm charts it works via controller.add-headers
    5.3.2 Ensure X-Content-Type-Options header is configured and enabled (Scored) ACTION NEEDED See previous answer See previous answer
    5.3.3 Ensure the X-XSS-Protection Header is enabled and configured properly (Scored) ACTION NEEDED See previous answer See previous answer
    5.3.4 Ensure that Content Security Policy (CSP) is enabled and configured properly (Not Scored) ACTION NEEDED See previous answer See previous answer
    5.3.5 Ensure the Referrer Policy is enabled and configured properly (Not Scored) ACTION NEEDED Depends on application. It should be handled in the applications webserver itself, not in the load balancing ingress check backend webserver
    6 Mandatory Access Control n/a too high level, depends on backends

    Hardening Guide

    Overview

    There are several ways to do hardening and securing of nginx. In this documentation two guides are used, the guides are overlapping in some points:

    This guide describes, what of the different configurations described in those guides is already implemented as default in the nginx implementation of kubernetes ingress, what needs to be configured, what is obsolete due to the fact that the nginx is running as container (the CIS benchmark relates to a non-containerized installation) and what is difficult or not possible.

    Be aware that this is only a guide and you are responsible for your own implementation. Some of the configurations may lead to have specific clients unable to reach your site or similar consequences.

    This guide refers to chapters in the CIS Benchmark. For full explanation you should refer to the benchmark document itself

    Configuration Guide

    Chapter in CIS benchmark Status Default Action to do if not default
    1 Initial Setup
    1.1 Installation
    1.1.1 Ensure NGINX is installed (Scored) OK done through helm charts / following documentation to deploy nginx ingress
    1.1.2 Ensure NGINX is installed from source (Not Scored) OK done through helm charts / following documentation to deploy nginx ingress
    1.2 Configure Software Updates
    1.2.1 Ensure package manager repositories are properly configured (Not Scored) OK done via helm, nginx version could be overwritten, however compatibility is not ensured then
    1.2.2 Ensure the latest software package is installed (Not Scored) ACTION NEEDED done via helm, nginx version could be overwritten, however compatibility is not ensured then Plan for periodic updates
    2 Basic Configuration
    2.1 Minimize NGINX Modules
    2.1.1 Ensure only required modules are installed (Not Scored) OK Already only needed modules are installed, however proposals for further reduction are welcome
    2.1.2 Ensure HTTP WebDAV module is not installed (Scored) OK
    2.1.3 Ensure modules with gzip functionality are disabled (Scored) OK
    2.1.4 Ensure the autoindex module is disabled (Scored) OK No autoindex configs so far in ingress defaults
    2.2 Account Security
    2.2.1 Ensure that NGINX is run using a non-privileged, dedicated service account (Not Scored) OK Pod configured as user www-data: See this line in helm chart values. Compiled with user www-data: See this line in build script
    2.2.2 Ensure the NGINX service account is locked (Scored) OK Docker design ensures this
    2.2.3 Ensure the NGINX service account has an invalid shell (Scored) OK Shell is nologin: see this line in build script
    2.3 Permissions and Ownership
    2.3.1 Ensure NGINX directories and files are owned by root (Scored) OK Obsolete through docker-design and ingress controller needs to update the configs dynamically
    2.3.2 Ensure access to NGINX directories and files is restricted (Scored) OK See previous answer
    2.3.3 Ensure the NGINX process ID (PID) file is secured (Scored) OK No PID-File due to docker design
    2.3.4 Ensure the core dump directory is secured (Not Scored) OK No working_directory configured by default
    2.4 Network Configuration
    2.4.1 Ensure NGINX only listens for network connections on authorized ports (Not Scored) OK Ensured by automatic nginx.conf configuration
    2.4.2 Ensure requests for unknown host names are rejected (Not Scored) OK They are not rejected but send to the "default backend" delivering appropriate errors (mostly 404)
    2.4.3 Ensure keepalive_timeout is 10 seconds or less, but not 0 (Scored) ACTION NEEDED Default is 75s configure keep-alive to 10 seconds according to this documentation
    2.4.4 Ensure send_timeout is set to 10 seconds or less, but not 0 (Scored) RISK TO BE ACCEPTED Not configured, however the nginx default is 60s Not configurable
    2.5 Information Disclosure
    2.5.1 Ensure server_tokens directive is set to off (Scored) OK server_tokens is configured to off by default
    2.5.2 Ensure default error and index.html pages do not reference NGINX (Scored) ACTION NEEDED 404 shows no version at all, 503 and 403 show "nginx", which is hardcoded see this line in nginx source code configure custom error pages at least for 403, 404 and 503 and 500
    2.5.3 Ensure hidden file serving is disabled (Not Scored) ACTION NEEDED config not set configure a config.server-snippet Snippet, but beware of .well-known challenges or similar. Refer to the benchmark here please
    2.5.4 Ensure the NGINX reverse proxy does not enable information disclosure (Scored) ACTION NEEDED hide not configured configure hide-headers with array of "X-Powered-By" and "Server": according to this documentation
    3 Logging
    3.1 Ensure detailed logging is enabled (Not Scored) OK nginx ingress has a very detailed log format by default
    3.2 Ensure access logging is enabled (Scored) OK Access log is enabled by default
    3.3 Ensure error logging is enabled and set to the info logging level (Scored) OK Error log is configured by default. The log level does not matter, because it is all sent to STDOUT anyway
    3.4 Ensure log files are rotated (Scored) OBSOLETE Log file handling is not part of the nginx ingress and should be handled separately
    3.5 Ensure error logs are sent to a remote syslog server (Not Scored) OBSOLETE See previous answer
    3.6 Ensure access logs are sent to a remote syslog server (Not Scored) OBSOLETE See previous answer
    3.7 Ensure proxies pass source IP information (Scored) OK Headers are set by default
    4 Encryption
    4.1 TLS / SSL Configuration
    4.1.1 Ensure HTTP is redirected to HTTPS (Scored) OK Redirect to TLS is default
    4.1.2 Ensure a trusted certificate and trust chain is installed (Not Scored) ACTION NEEDED For installing certs there are enough manuals in the web. A good way is to use lets encrypt through cert-manager Install proper certificates or use lets encrypt with cert-manager
    4.1.3 Ensure private key permissions are restricted (Scored) ACTION NEEDED See previous answer
    4.1.4 Ensure only modern TLS protocols are used (Scored) OK/ACTION NEEDED Default is TLS 1.2 + 1.3, while this is okay for CIS Benchmark, cipherlist.eu only recommends 1.3. This may cut off old OS's Set controller.config.ssl-protocols to "TLSv1.3"
    4.1.5 Disable weak ciphers (Scored) ACTION NEEDED Default ciphers are already good, but cipherlist.eu recommends even stronger ciphers Set controller.config.ssl-ciphers to "EECDH+AESGCM:EDH+AESGCM"
    4.1.6 Ensure custom Diffie-Hellman parameters are used (Scored) ACTION NEEDED No custom DH parameters are generated Generate dh parameters for each ingress deployment you use - see here for a how to
    4.1.7 Ensure Online Certificate Status Protocol (OCSP) stapling is enabled (Scored) ACTION NEEDED Not enabled set via this configuration parameter
    4.1.8 Ensure HTTP Strict Transport Security (HSTS) is enabled (Scored) OK HSTS is enabled by default
    4.1.9 Ensure HTTP Public Key Pinning is enabled (Not Scored) ACTION NEEDED / RISK TO BE ACCEPTED HKPK not enabled by default If lets encrypt is not used, set correct HPKP header. There are several ways to implement this - with the helm charts it works via controller.add-headers. If lets encrypt is used, this is complicated, a solution here is yet unknown
    4.1.10 Ensure upstream server traffic is authenticated with a client certificate (Scored) DEPENDS ON BACKEND Highly dependent on backends, not every backend allows configuring this, can also be mitigated via a service mesh If backend allows it, manual is here
    4.1.11 Ensure the upstream traffic server certificate is trusted (Not Scored) DEPENDS ON BACKEND Highly dependent on backends, not every backend allows configuring this, can also be mitigated via a service mesh If backend allows it, see configuration here
    4.1.12 Ensure your domain is preloaded (Not Scored) ACTION NEEDED Preload is not active by default Set controller.config.hsts-preload to true
    4.1.13 Ensure session resumption is disabled to enable perfect forward security (Scored) OK Session tickets are disabled by default
    4.1.14 Ensure HTTP/2.0 is used (Not Scored) OK http2 is set by default
    5 Request Filtering and Restrictions
    5.1 Access Control
    5.1.1 Ensure allow and deny filters limit access to specific IP addresses (Not Scored) OK/ACTION NEEDED Depends on use case, geo ip module is compiled into nginx ingress controller, there are several ways to use it If needed set IP restrictions via annotations or work with config snippets (be careful with lets-encrypt-http-challenge!)
    5.1.2 Ensure only whitelisted HTTP methods are allowed (Not Scored) OK/ACTION NEEDED Depends on use case If required it can be set via config snippet
    5.2 Request Limits
    5.2.1 Ensure timeout values for reading the client header and body are set correctly (Scored) ACTION NEEDED Default timeout is 60s Set via this configuration parameter and respective body equivalent
    5.2.2 Ensure the maximum request body size is set correctly (Scored) ACTION NEEDED Default is 1m set via this configuration parameter
    5.2.3 Ensure the maximum buffer size for URIs is defined (Scored) ACTION NEEDED Default is 4 8k Set via this configuration parameter
    5.2.4 Ensure the number of connections per IP address is limited (Not Scored) OK/ACTION NEEDED No limit set Depends on use case, limit can be set via these annotations
    5.2.5 Ensure rate limits by IP address are set (Not Scored) OK/ACTION NEEDED No limit set Depends on use case, limit can be set via these annotations
    5.3 Browser Security
    5.3.1 Ensure X-Frame-Options header is configured and enabled (Scored) ACTION NEEDED Header not set by default Several ways to implement this - with the helm charts it works via controller.add-headers
    5.3.2 Ensure X-Content-Type-Options header is configured and enabled (Scored) ACTION NEEDED See previous answer See previous answer
    5.3.3 Ensure the X-XSS-Protection Header is enabled and configured properly (Scored) ACTION NEEDED See previous answer See previous answer
    5.3.4 Ensure that Content Security Policy (CSP) is enabled and configured properly (Not Scored) ACTION NEEDED See previous answer See previous answer
    5.3.5 Ensure the Referrer Policy is enabled and configured properly (Not Scored) ACTION NEEDED Depends on application. It should be handled in the applications webserver itself, not in the load balancing ingress check backend webserver
    6 Mandatory Access Control n/a too high level, depends on backends

    Installation Guide

    There are multiple ways to install the NGINX ingress controller:

    • with Helm, using the project repository chart;
    • with kubectl apply, using YAML manifests;
    • with specific addons (e.g. for minikube or MicroK8s).

    On most Kubernetes clusters, the ingress controller will work without requiring any extra configuration. If you want to get started as fast as possible, you can check the quick start instructions. However, in many environments, you can improve the performance or get better logs by enabling extra features. We recommend that you check the environment-specific instructions for details about optimizing the ingress controller for your particular environment or cloud provider.

    Contents

    e2e test suite for Ingress NGINX Controller

    [Serial] admission controller

    modsecurity owasp

    affinitymode

    server-alias

    app-root

    auth-tls-*

    backend-protocol

    canary-*

    client-body-buffer-size

    connection-proxy-header

    cors-*

    custom-http-errors

    default-backend

    disable-access-log disable-http-access-log disable-stream-access-log

    backend-protocol - FastCGI

    force-ssl-redirect

    from-to-www-redirect

    annotation-global-rate-limit

    backend-protocol - GRPC

    http2-push-preload

    influxdb-*

    whitelist-source-range

    Annotation - limit-connections

    limit-rate

    enable-access-log enable-rewrite-log

    mirror-*

    preserve-trailing-slash

    proxy-*

    proxy-ssl-*

    permanent-redirect permanent-redirect-code

    satisfy

    server-snippet

    service-upstream

    configuration-snippet

    ssl-ciphers

    stream-snippet

    upstream-hash-by-*

    upstream-vhost

    x-forwarded-prefix

    rewrite-target use-regex enable-rewrite-log

    auth-*

    denylist-source-range

    Debug CLI

    [Default Backend] custom service

    [Default Backend]

    [Default Backend] SSL

    [Default Backend] change default settings

    [Setting]

    [Shutdown] Grace period shutdown

    [Shutdown] ingress controller

    [Shutdown] Graceful shutdown with pending request

    [Ingress] DeepInspection

    single ingress - multiple hosts

    [Ingress] [PathType] exact

    [Ingress] [PathType] mix Exact and Prefix paths

    [Ingress] [PathType] prefix checks

    [Ingress] definition without host

    [Memory Leak] Dynamic Certificates

    [Load Balancer] load-balance

    [Load Balancer] EWMA

    [Load Balancer] round-robin

    [Lua] dynamic certificates

    [Lua] dynamic configuration

    [Security] request smuggling

    [Service] backend status code 503

    [Service] Type ExternalName

    [Service] Nil Service Backend

    [Security] modsecurity-snippet

    OCSP

    access-log

    Bad annotation values

    brotli

    Configmap change

    add-headers

    [SSL] [Flag] default-ssl-certificate

    [Flag] disable-catch-all

    [Flag] disable-service-external-name

    enable-real-ip

    use-forwarded-headers

    Geoip2

    [Security] block-*

    [Security] global-auth-url

    global-options

    settings-global-rate-limit

    hash size

    [Flag] ingress-class

    keep-alive keep-alive-requests

    Configmap - limit-rate

    [Flag] custom HTTP and HTTPS ports

    log-format-*

    [Lua] lua-shared-dicts

    main-snippet

    enable-multi-accept

    [Flag] watch namespace selector

    [Security] no-auth-locations

    Add no tls redirect locations

    Configure OpenTracing

    plugins

    [Security] Pod Security Policies

    [Security] Pod Security Policies with volumes

    proxy-connect-timeout

    Dynamic $proxy_host

    proxy-next-upstream

    use-proxy-protocol

    proxy-read-timeout

    proxy-send-timeout

    reuse-port

    configmap server-snippet

    server-tokens

    ssl-ciphers

    configmap stream-snippet

    [SSL] TLS protocols, ciphers and headers)

    [Flag] disable-sync-events

    gzip

    With enable-ssl-passthrough enabled

    [SSL] redirect to HTTPS

    [SSL] secret update

    [Status] status update

    [TCP] tcp-services

    [Endpointslices] long service name

    [TopologyHints] topology aware routing

    nginx-configuration

    Remove static SSL configuration mode

    Table of Contents

    Summary

    Since release 0.19.0 is possible to configure SSL certificates without the need of NGINX reloads (thanks to lua) and after release 0.24.0 the default enabled mode is dynamic.

    Motivation

    The static configuration implies reloads, something that affects the majority of the users.

    Goals

    • Deprecation of the flag --enable-dynamic-certificates.
    • Cleanup of the codebase.

    Non-Goals

    • Features related to certificate authentication are not changed in any way.

    Proposal

    • Remove static SSL configuration

    Implementation Details/Notes/Constraints

    • Deprecate the flag Move the directives ssl_certificate and ssl_certificate_key from each server block to the http section. These settings are required to avoid NGINX errors in the logs.
    • Remove any action of the flag --enable-dynamic-certificates

    Drawbacks

    Alternatives

    Keep both implementations

    Remove static SSL configuration mode

    Table of Contents

    Summary

    Since release 0.19.0 is possible to configure SSL certificates without the need of NGINX reloads (thanks to lua) and after release 0.24.0 the default enabled mode is dynamic.

    Motivation

    The static configuration implies reloads, something that affects the majority of the users.

    Goals

    • Deprecation of the flag --enable-dynamic-certificates.
    • Cleanup of the codebase.

    Non-Goals

    • Features related to certificate authentication are not changed in any way.

    Proposal

    • Remove static SSL configuration

    Implementation Details/Notes/Constraints

    • Deprecate the flag Move the directives ssl_certificate and ssl_certificate_key from each server block to the http section. These settings are required to avoid NGINX errors in the logs.
    • Remove any action of the flag --enable-dynamic-certificates

    Drawbacks

    Alternatives

    Keep both implementations

    Availability zone aware routing

    Table of Contents

    Summary

    Teach ingress-nginx about availability zones where endpoints are running in. This way ingress-nginx pod will do its best to proxy to zone-local endpoint.

    Motivation

    When users run their services across multiple availability zones they usually pay for egress traffic between zones. Providers such as GCP, and Amazon EC2 usually charge extra for this feature. ingress-nginx when picking an endpoint to route request to does not consider whether the endpoint is in a different zone or the same one. That means it's at least equally likely that it will pick an endpoint from another zone and proxy the request to it. In this situation response from the endpoint to the ingress-nginx pod is considered inter-zone traffic and usually costs extra money.

    At the time of this writing, GCP charges $0.01 per GB of inter-zone egress traffic according to https://cloud.google.com/compute/network-pricing. According to https://datapath.io/resources/blog/what-are-aws-data-transfer-costs-and-how-to-minimize-them/ Amazon also charges the same amount of money as GCP for cross-zone, egress traffic.

    This can be a lot of money depending on once's traffic. By teaching ingress-nginx about zones we can eliminate or at least decrease this cost.

    Arguably inter-zone network latency should also be better than cross-zone.

    Goals

    • Given a regional cluster running ingress-nginx, ingress-nginx should do best-effort to pick a zone-local endpoint when proxying
    • This should not impact canary feature
    • ingress-nginx should be able to operate successfully if there are no zonal endpoints

    Non-Goals

    • This feature inherently assumes that endpoints are distributed across zones in a way that they can handle all the traffic from ingress-nginx pod(s) in that zone
    • This feature will be relying on https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/#failure-domainbetakubernetesiozone, it is not this KEP's goal to support other cases

    Proposal

    The idea here is to have the controller part of ingress-nginx (1) detect what zone its current pod is running in and (2) detect the zone for every endpoint it knows about. After that, it will post that data as part of endpoints to Lua land. When picking an endpoint, the Lua balancer will try to pick zone-local endpoint first and if there is no zone-local endpoint then it will fall back to current behavior.

    Initially, this feature should be optional since it is going to make it harder to reason about the load balancing and not everyone might want that.

    How does controller know what zone it runs in? We can have the pod spec pass the node name using downward API as an environment variable. Upon startup, the controller can get node details from the API based on the node name. Once the node details are obtained we can extract the zone from the failure-domain.beta.kubernetes.io/zone annotation. Then we can pass that value to Lua land through Nginx configuration when loading lua_ingress.lua module in init_by_lua phase.

    How do we extract zones for endpoints? We can have the controller watch create and update events on nodes in the entire cluster and based on that keep the map of nodes to zones in the memory. And when we generate endpoints list, we can access node name using .subsets.addresses[i].nodeName and based on that fetch zone from the map in memory and store it as a field on the endpoint. This solution assumes failure-domain.beta.kubernetes.io/zone annotation does not change until the end of the node's life. Otherwise, we have to watch update events as well on the nodes and that'll add even more overhead.

    Alternatively, we can get the list of nodes only when there's no node in the memory for the given node name. This is probably a better solution because then we would avoid watching for API changes on node resources. We can eagerly fetch all the nodes and build node name to zone mapping on start. From there on, it will sync during endpoint building in the main event loop if there's no existing entry for the node of an endpoint. This means an extra API call in case cluster has expanded.

    How do we make sure we do our best to choose zone-local endpoint? This will be done on the Lua side. For every backend, we will initialize two balancer instances: (1) with all endpoints (2) with all endpoints corresponding to the current zone for the backend. Then given the request once we choose what backend needs to serve the request, we will first try to use a zonal balancer for that backend. If a zonal balancer does not exist (i.e. there's no zonal endpoint) then we will use a general balancer. In case of zonal outages, we assume that the readiness probe will fail and the controller will see no endpoints for the backend and therefore we will use a general balancer.

    We can enable the feature using a configmap setting. Doing it this way makes it easier to rollback in case of a problem.

    Implementation History

    • initial version of KEP is shipped
    • proposal and implementation details are done

    Drawbacks [optional]

    More load on the Kubernetes API server.

    Availability zone aware routing

    Table of Contents

    Summary

    Teach ingress-nginx about availability zones where endpoints are running in. This way ingress-nginx pod will do its best to proxy to zone-local endpoint.

    Motivation

    When users run their services across multiple availability zones they usually pay for egress traffic between zones. Providers such as GCP, and Amazon EC2 usually charge extra for this feature. ingress-nginx when picking an endpoint to route request to does not consider whether the endpoint is in a different zone or the same one. That means it's at least equally likely that it will pick an endpoint from another zone and proxy the request to it. In this situation response from the endpoint to the ingress-nginx pod is considered inter-zone traffic and usually costs extra money.

    At the time of this writing, GCP charges $0.01 per GB of inter-zone egress traffic according to https://cloud.google.com/compute/network-pricing. According to https://datapath.io/resources/blog/what-are-aws-data-transfer-costs-and-how-to-minimize-them/ Amazon also charges the same amount of money as GCP for cross-zone, egress traffic.

    This can be a lot of money depending on once's traffic. By teaching ingress-nginx about zones we can eliminate or at least decrease this cost.

    Arguably inter-zone network latency should also be better than cross-zone.

    Goals

    • Given a regional cluster running ingress-nginx, ingress-nginx should do best-effort to pick a zone-local endpoint when proxying
    • This should not impact canary feature
    • ingress-nginx should be able to operate successfully if there are no zonal endpoints

    Non-Goals

    • This feature inherently assumes that endpoints are distributed across zones in a way that they can handle all the traffic from ingress-nginx pod(s) in that zone
    • This feature will be relying on https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/#failure-domainbetakubernetesiozone, it is not this KEP's goal to support other cases

    Proposal

    The idea here is to have the controller part of ingress-nginx (1) detect what zone its current pod is running in and (2) detect the zone for every endpoint it knows about. After that, it will post that data as part of endpoints to Lua land. When picking an endpoint, the Lua balancer will try to pick zone-local endpoint first and if there is no zone-local endpoint then it will fall back to current behavior.

    Initially, this feature should be optional since it is going to make it harder to reason about the load balancing and not everyone might want that.

    How does controller know what zone it runs in? We can have the pod spec pass the node name using downward API as an environment variable. Upon startup, the controller can get node details from the API based on the node name. Once the node details are obtained we can extract the zone from the failure-domain.beta.kubernetes.io/zone annotation. Then we can pass that value to Lua land through Nginx configuration when loading lua_ingress.lua module in init_by_lua phase.

    How do we extract zones for endpoints? We can have the controller watch create and update events on nodes in the entire cluster and based on that keep the map of nodes to zones in the memory. And when we generate endpoints list, we can access node name using .subsets.addresses[i].nodeName and based on that fetch zone from the map in memory and store it as a field on the endpoint. This solution assumes failure-domain.beta.kubernetes.io/zone annotation does not change until the end of the node's life. Otherwise, we have to watch update events as well on the nodes and that'll add even more overhead.

    Alternatively, we can get the list of nodes only when there's no node in the memory for the given node name. This is probably a better solution because then we would avoid watching for API changes on node resources. We can eagerly fetch all the nodes and build node name to zone mapping on start. From there on, it will sync during endpoint building in the main event loop if there's no existing entry for the node of an endpoint. This means an extra API call in case cluster has expanded.

    How do we make sure we do our best to choose zone-local endpoint? This will be done on the Lua side. For every backend, we will initialize two balancer instances: (1) with all endpoints (2) with all endpoints corresponding to the current zone for the backend. Then given the request once we choose what backend needs to serve the request, we will first try to use a zonal balancer for that backend. If a zonal balancer does not exist (i.e. there's no zonal endpoint) then we will use a general balancer. In case of zonal outages, we assume that the readiness probe will fail and the controller will see no endpoints for the backend and therefore we will use a general balancer.

    We can enable the feature using a configmap setting. Doing it this way makes it easier to rollback in case of a problem.

    Implementation History

    • initial version of KEP is shipped
    • proposal and implementation details are done

    Drawbacks [optional]

    More load on the Kubernetes API server.

    Title

    This is the title of the KEP. Keep it simple and descriptive. A good title can help communicate what the KEP is and should be considered as part of any review.

    The title should be lowercased and spaces/punctuation should be replaced with -.

    To get started with this template:

    1. Make a copy of this template. Create a copy of this template and name it YYYYMMDD-my-title.md, where YYYYMMDD is the date the KEP was first drafted.
    2. Fill out the "overview" sections. This includes the Summary and Motivation sections. These should be easy if you've preflighted the idea of the KEP in an issue.
    3. Create a PR. Assign it to folks that are sponsoring this process.
    4. Create an issue When filing an enhancement tracking issue, please ensure to complete all fields in the template.
    5. Merge early. Avoid getting hung up on specific details and instead aim to get the goal of the KEP merged quickly. The best way to do this is to just start with the "Overview" sections and fill out details incrementally in follow on PRs. View anything marked as a provisional as a working document and subject to change. Aim for single topic PRs to keep discussions focused. If you disagree with what is already in a document, open a new PR with suggested changes.

    The canonical place for the latest set of instructions (and the likely source of this file) is here.

    The Metadata section above is intended to support the creation of tooling around the KEP process. This will be a YAML section that is fenced as a code block. See the KEP process for details on each of these items.

    Table of Contents

    A table of contents is helpful for quickly jumping to sections of a KEP and for highlighting any additional information provided beyond the standard KEP template.

    Ensure the TOC is wrapped with <!-- toc --&rt;<!-- /toc --&rt; tags, and then generate with hack/update-toc.sh.

    Summary

    The Summary section is incredibly important for producing high quality user-focused documentation such as release notes or a development roadmap. It should be possible to collect this information before implementation begins in order to avoid requiring implementers to split their attention between writing release notes and implementing the feature itself.

    A good summary is probably at least a paragraph in length.

    Motivation

    This section is for explicitly listing the motivation, goals and non-goals of this KEP. Describe why the change is important and the benefits to users. The motivation section can optionally provide links to experience reports to demonstrate the interest in a KEP within the wider Kubernetes community.

    Goals

    List the specific goals of the KEP. How will we know that this has succeeded?

    Non-Goals

    What is out of scope for this KEP? Listing non-goals helps to focus discussion and make progress.

    Proposal

    This is where we get down to the nitty gritty of what the proposal actually is.

    User Stories [optional]

    Detail the things that people will be able to do if this KEP is implemented. Include as much detail as possible so that people can understand the "how" of the system. The goal here is to make this feel real for users without getting bogged down.

    Story 1

    Story 2

    Implementation Details/Notes/Constraints [optional]

    What are the caveats to the implementation? What are some important details that didn't come across above. Go in to as much detail as necessary here. This might be a good place to talk about core concepts and how they relate.

    Risks and Mitigations

    What are the risks of this proposal and how do we mitigate. Think broadly. For example, consider both security and how this will impact the larger kubernetes ecosystem.

    How will security be reviewed and by whom? How will UX be reviewed and by whom?

    Consider including folks that also work outside project.

    Design Details

    Test Plan

    Note: Section not required until targeted at a release.

    Consider the following in developing a test plan for this enhancement:

    • Will there be e2e and integration tests, in addition to unit tests?
    • How will it be tested in isolation vs with other components?

    No need to outline all of the test cases, just the general strategy. Anything that would count as tricky in the implementation and anything particularly challenging to test should be called out.

    All code is expected to have adequate tests (eventually with coverage expectations). Please adhere to the Kubernetes testing guidelines when drafting this test plan.

    Removing a deprecated flag

    • Announce deprecation and support policy of the existing flag
    • Two versions passed since introducing the functionality which deprecates the flag (to address version skew)
    • Address feedback on usage/changed behavior, provided on GitHub issues
    • Deprecate the flag

    Implementation History

    Major milestones in the life cycle of a KEP should be tracked in Implementation History. Major milestones might include

    • the Summary and Motivation sections being merged signaling acceptance
    • the Proposal section being merged signaling agreement on a proposed design
    • the date implementation started
    • the first Kubernetes release where an initial version of the KEP was available
    • the version of Kubernetes where the KEP graduated to general availability
    • when the KEP was retired or superseded

    Drawbacks [optional]

    Why should this KEP not be implemented.

    Alternatives [optional]

    Similar to the Drawbacks section the Alternatives section is used to highlight and record other possible approaches to delivering the value proposed by a KEP.

    Title

    This is the title of the KEP. Keep it simple and descriptive. A good title can help communicate what the KEP is and should be considered as part of any review.

    The title should be lowercased and spaces/punctuation should be replaced with -.

    To get started with this template:

    1. Make a copy of this template. Create a copy of this template and name it YYYYMMDD-my-title.md, where YYYYMMDD is the date the KEP was first drafted.
    2. Fill out the "overview" sections. This includes the Summary and Motivation sections. These should be easy if you've preflighted the idea of the KEP in an issue.
    3. Create a PR. Assign it to folks that are sponsoring this process.
    4. Create an issue When filing an enhancement tracking issue, please ensure to complete all fields in the template.
    5. Merge early. Avoid getting hung up on specific details and instead aim to get the goal of the KEP merged quickly. The best way to do this is to just start with the "Overview" sections and fill out details incrementally in follow on PRs. View anything marked as a provisional as a working document and subject to change. Aim for single topic PRs to keep discussions focused. If you disagree with what is already in a document, open a new PR with suggested changes.

    The canonical place for the latest set of instructions (and the likely source of this file) is here.

    The Metadata section above is intended to support the creation of tooling around the KEP process. This will be a YAML section that is fenced as a code block. See the KEP process for details on each of these items.

    Table of Contents

    A table of contents is helpful for quickly jumping to sections of a KEP and for highlighting any additional information provided beyond the standard KEP template.

    Ensure the TOC is wrapped with <!-- toc --&rt;<!-- /toc --&rt; tags, and then generate with hack/update-toc.sh.

    Summary

    The Summary section is incredibly important for producing high quality user-focused documentation such as release notes or a development roadmap. It should be possible to collect this information before implementation begins in order to avoid requiring implementers to split their attention between writing release notes and implementing the feature itself.

    A good summary is probably at least a paragraph in length.

    Motivation

    This section is for explicitly listing the motivation, goals and non-goals of this KEP. Describe why the change is important and the benefits to users. The motivation section can optionally provide links to experience reports to demonstrate the interest in a KEP within the wider Kubernetes community.

    Goals

    List the specific goals of the KEP. How will we know that this has succeeded?

    Non-Goals

    What is out of scope for this KEP? Listing non-goals helps to focus discussion and make progress.

    Proposal

    This is where we get down to the nitty gritty of what the proposal actually is.

    User Stories [optional]

    Detail the things that people will be able to do if this KEP is implemented. Include as much detail as possible so that people can understand the "how" of the system. The goal here is to make this feel real for users without getting bogged down.

    Story 1

    Story 2

    Implementation Details/Notes/Constraints [optional]

    What are the caveats to the implementation? What are some important details that didn't come across above. Go in to as much detail as necessary here. This might be a good place to talk about core concepts and how they relate.

    Risks and Mitigations

    What are the risks of this proposal and how do we mitigate. Think broadly. For example, consider both security and how this will impact the larger kubernetes ecosystem.

    How will security be reviewed and by whom? How will UX be reviewed and by whom?

    Consider including folks that also work outside project.

    Design Details

    Test Plan

    Note: Section not required until targeted at a release.

    Consider the following in developing a test plan for this enhancement:

    • Will there be e2e and integration tests, in addition to unit tests?
    • How will it be tested in isolation vs with other components?

    No need to outline all of the test cases, just the general strategy. Anything that would count as tricky in the implementation and anything particularly challenging to test should be called out.

    All code is expected to have adequate tests (eventually with coverage expectations). Please adhere to the Kubernetes testing guidelines when drafting this test plan.

    Removing a deprecated flag

    • Announce deprecation and support policy of the existing flag
    • Two versions passed since introducing the functionality which deprecates the flag (to address version skew)
    • Address feedback on usage/changed behavior, provided on GitHub issues
    • Deprecate the flag

    Implementation History

    Major milestones in the life cycle of a KEP should be tracked in Implementation History. Major milestones might include

    • the Summary and Motivation sections being merged signaling acceptance
    • the Proposal section being merged signaling agreement on a proposed design
    • the date implementation started
    • the first Kubernetes release where an initial version of the KEP was available
    • the version of Kubernetes where the KEP graduated to general availability
    • when the KEP was retired or superseded

    Drawbacks [optional]

    Why should this KEP not be implemented.

    Alternatives [optional]

    Similar to the Drawbacks section the Alternatives section is used to highlight and record other possible approaches to delivering the value proposed by a KEP.

    Kubernetes Enhancement Proposals (KEPs)

    A Kubernetes Enhancement Proposal (KEP) is a way to propose, communicate and coordinate on new efforts for the Kubernetes project. For this reason, the ingress-nginx project is adopting it.

    Quick start for the KEP process

    Follow the process outlined in the KEP template

    Do I have to use the KEP process?

    No... but we hope that you will. Over time having a rich set of KEPs in one place will make it easier for people to track what is going on in the community and find a structured historic record.

    KEPs are only required when the changes are wide ranging and impact most of the project.

    Why would I want to use the KEP process?

    Our aim with KEPs is to clearly communicate new efforts to the Kubernetes contributor community. As such, we want to build a well curated set of clear proposals in a common format with useful metadata.

    Benefits to KEP users (in the limit):

    • Exposure on a kubernetes blessed web site that is findable via web search engines.
    • Cross indexing of KEPs so that users can find connections and the current status of any KEP.
    • A clear process with approvers and reviewers for making decisions. This will lead to more structured decisions that stick as there is a discoverable record around the decisions.

    We are inspired by IETF RFCs, Python PEPs, and Rust RFCs.

    Kubernetes Enhancement Proposals (KEPs)

    A Kubernetes Enhancement Proposal (KEP) is a way to propose, communicate and coordinate on new efforts for the Kubernetes project. For this reason, the ingress-nginx project is adopting it.

    Quick start for the KEP process

    Follow the process outlined in the KEP template

    Do I have to use the KEP process?

    No... but we hope that you will. Over time having a rich set of KEPs in one place will make it easier for people to track what is going on in the community and find a structured historic record.

    KEPs are only required when the changes are wide ranging and impact most of the project.

    Why would I want to use the KEP process?

    Our aim with KEPs is to clearly communicate new efforts to the Kubernetes contributor community. As such, we want to build a well curated set of clear proposals in a common format with useful metadata.

    Benefits to KEP users (in the limit):

    • Exposure on a kubernetes blessed web site that is findable via web search engines.
    • Cross indexing of KEPs so that users can find connections and the current status of any KEP.
    • A clear process with approvers and reviewers for making decisions. This will lead to more structured decisions that stick as there is a discoverable record around the decisions.

    We are inspired by IETF RFCs, Python PEPs, and Rust RFCs.

    Prerequisites

    Many of the examples in this directory have common prerequisites.

    TLS certificates

    Unless otherwise mentioned, the TLS secret used in examples is a 2048 bit RSA key/cert pair with an arbitrarily chosen hostname, created as follows

    $ openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=nginxsvc/O=nginxsvc"
    + Prerequisites - NGINX Ingress Controller      

    Prerequisites

    Many of the examples in this directory have common prerequisites.

    TLS certificates

    Unless otherwise mentioned, the TLS secret used in examples is a 2048 bit RSA key/cert pair with an arbitrarily chosen hostname, created as follows

    $ openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=nginxsvc/O=nginxsvc"
     Generating a 2048 bit RSA private key
     ................+++
     ................+++
    diff --git a/examples/affinity/cookie/index.html b/examples/affinity/cookie/index.html
    index 3ba14349b..e32048cd3 100644
    --- a/examples/affinity/cookie/index.html
    +++ b/examples/affinity/cookie/index.html
    @@ -1,4 +1,4 @@
    - Sticky Sessions - NGINX Ingress Controller      

    Sticky sessions

    This example demonstrates how to achieve session affinity using cookies.

    Deployment

    Session affinity can be configured using the following annotations:

    Name Description Value
    nginx.ingress.kubernetes.io/affinity Type of the affinity, set this to cookie to enable session affinity string (NGINX only supports cookie)
    nginx.ingress.kubernetes.io/affinity-mode The affinity mode defines how sticky a session is. Use balanced to redistribute some sessions when scaling pods or persistent for maximum stickiness. balanced (default) or persistent
    nginx.ingress.kubernetes.io/affinity-canary-behavior Defines session affinity behavior of canaries. By default the behavior is sticky, and canaries respect session affinity configuration. Set this to legacy to restore original canary behavior, when session affinity parameters were not respected. sticky (default) or legacy
    nginx.ingress.kubernetes.io/session-cookie-name Name of the cookie that will be created string (defaults to INGRESSCOOKIE)
    nginx.ingress.kubernetes.io/session-cookie-secure Set the cookie as secure regardless the protocol of the incoming request "true" or "false"
    nginx.ingress.kubernetes.io/session-cookie-path Path that will be set on the cookie (required if your Ingress paths use regular expressions) string (defaults to the currently matched path)
    nginx.ingress.kubernetes.io/session-cookie-domain Domain that will be set on the cookie string
    nginx.ingress.kubernetes.io/session-cookie-samesite SameSite attribute to apply to the cookie Browser accepted values are None, Lax, and Strict
    nginx.ingress.kubernetes.io/session-cookie-conditional-samesite-none Will omit SameSite=None attribute for older browsers which reject the more-recently defined SameSite=None value "true" or "false"
    nginx.ingress.kubernetes.io/session-cookie-max-age Time until the cookie expires, corresponds to the Max-Age cookie directive number of seconds
    nginx.ingress.kubernetes.io/session-cookie-expires Legacy version of the previous annotation for compatibility with older browsers, generates an Expires cookie directive by adding the seconds to the current date number of seconds
    nginx.ingress.kubernetes.io/session-cookie-change-on-failure When set to false nginx ingress will send request to upstream pointed by sticky cookie even if previous attempt failed. When set to true and previous attempt failed, sticky cookie will be changed to point to another upstream. true or false (defaults to false)

    You can create the session affinity example Ingress to test this:

    kubectl create -f ingress.yaml
    + Sticky Sessions - NGINX Ingress Controller      

    Sticky sessions

    This example demonstrates how to achieve session affinity using cookies.

    Deployment

    Session affinity can be configured using the following annotations:

    Name Description Value
    nginx.ingress.kubernetes.io/affinity Type of the affinity, set this to cookie to enable session affinity string (NGINX only supports cookie)
    nginx.ingress.kubernetes.io/affinity-mode The affinity mode defines how sticky a session is. Use balanced to redistribute some sessions when scaling pods or persistent for maximum stickiness. balanced (default) or persistent
    nginx.ingress.kubernetes.io/affinity-canary-behavior Defines session affinity behavior of canaries. By default the behavior is sticky, and canaries respect session affinity configuration. Set this to legacy to restore original canary behavior, when session affinity parameters were not respected. sticky (default) or legacy
    nginx.ingress.kubernetes.io/session-cookie-name Name of the cookie that will be created string (defaults to INGRESSCOOKIE)
    nginx.ingress.kubernetes.io/session-cookie-secure Set the cookie as secure regardless the protocol of the incoming request "true" or "false"
    nginx.ingress.kubernetes.io/session-cookie-path Path that will be set on the cookie (required if your Ingress paths use regular expressions) string (defaults to the currently matched path)
    nginx.ingress.kubernetes.io/session-cookie-domain Domain that will be set on the cookie string
    nginx.ingress.kubernetes.io/session-cookie-samesite SameSite attribute to apply to the cookie Browser accepted values are None, Lax, and Strict
    nginx.ingress.kubernetes.io/session-cookie-conditional-samesite-none Will omit SameSite=None attribute for older browsers which reject the more-recently defined SameSite=None value "true" or "false"
    nginx.ingress.kubernetes.io/session-cookie-max-age Time until the cookie expires, corresponds to the Max-Age cookie directive number of seconds
    nginx.ingress.kubernetes.io/session-cookie-expires Legacy version of the previous annotation for compatibility with older browsers, generates an Expires cookie directive by adding the seconds to the current date number of seconds
    nginx.ingress.kubernetes.io/session-cookie-change-on-failure When set to false nginx ingress will send request to upstream pointed by sticky cookie even if previous attempt failed. When set to true and previous attempt failed, sticky cookie will be changed to point to another upstream. true or false (defaults to false)

    You can create the session affinity example Ingress to test this:

    kubectl create -f ingress.yaml
     

    Validation

    You can confirm that the Ingress works:

    $ kubectl describe ing nginx-test
     Name:           nginx-test
     Namespace:      default
    diff --git a/examples/auth/basic/index.html b/examples/auth/basic/index.html
    index a97b33acd..c50154859 100644
    --- a/examples/auth/basic/index.html
    +++ b/examples/auth/basic/index.html
    @@ -1,4 +1,4 @@
    - Basic Authentication - NGINX Ingress Controller      

    Basic Authentication

    This example shows how to add authentication in a Ingress rule using a secret that contains a file generated with htpasswd. It's important the file generated is named auth (actually - that the secret has a key data.auth), otherwise the ingress-controller returns a 503.

    Create htpasswd file

    $ htpasswd -c auth foo
    + Basic Authentication - NGINX Ingress Controller      

    Basic Authentication

    This example shows how to add authentication in a Ingress rule using a secret that contains a file generated with htpasswd. It's important the file generated is named auth (actually - that the secret has a key data.auth), otherwise the ingress-controller returns a 503.

    Create htpasswd file

    $ htpasswd -c auth foo
     New password: <bar>
     New password:
     Re-type new password:
    diff --git a/examples/auth/client-certs/index.html b/examples/auth/client-certs/index.html
    index e0c096927..8b7f00ce4 100644
    --- a/examples/auth/client-certs/index.html
    +++ b/examples/auth/client-certs/index.html
    @@ -1,4 +1,4 @@
    - Client Certificate Authentication - NGINX Ingress Controller      

    Client Certificate Authentication

    It is possible to enable Client-Certificate Authentication by adding additional annotations to your Ingress Resource.

    Before getting started you must have the following Certificates configured:

    1. CA certificate and Key (Intermediate Certs need to be in CA)
    2. Server Certificate (Signed by CA) and Key (CN should be equal the hostname you will use)
    3. Client Certificate (Signed by CA) and Key

    For more details on the generation process, checkout the Prerequisite docs.

    You can have as many certificates as you want. If they're in the binary DER format, you can convert them as the following:

    openssl x509 -in certificate.der -inform der -out certificate.crt -outform pem
    + Client Certificate Authentication - NGINX Ingress Controller      

    Client Certificate Authentication

    It is possible to enable Client-Certificate Authentication by adding additional annotations to your Ingress Resource.

    Before getting started you must have the following Certificates configured:

    1. CA certificate and Key (Intermediate Certs need to be in CA)
    2. Server Certificate (Signed by CA) and Key (CN should be equal the hostname you will use)
    3. Client Certificate (Signed by CA) and Key

    For more details on the generation process, checkout the Prerequisite docs.

    You can have as many certificates as you want. If they're in the binary DER format, you can convert them as the following:

    openssl x509 -in certificate.der -inform der -out certificate.crt -outform pem
     

    Then, you can concatenate them all into one file, named 'ca.crt' with the following:

    cat certificate1.crt certificate2.crt certificate3.crt >> ca.crt
     

    Note: Make sure that the Key Size is greater than 1024 and Hashing Algorithm (Digest) is something better than md5 for each certificate generated. Otherwise you will receive an error.

    Creating Certificate Secrets

    There are many different ways of configuring your secrets to enable Client-Certificate Authentication to work properly.