Deploy GitHub Pages
This commit is contained in:
parent
a078100980
commit
467b6d7499
54 changed files with 5641 additions and 2237 deletions
|
|
@ -246,7 +246,7 @@
|
|||
|
||||
<li class="md-tabs__item">
|
||||
|
||||
<a href="../../../examples/PREREQUISITES/" title="Examples" class="md-tabs__link">
|
||||
<a href="../../../examples/" title="Examples" class="md-tabs__link">
|
||||
Examples
|
||||
</a>
|
||||
|
||||
|
|
@ -360,6 +360,18 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../../deploy/upgrade/" title="Upgrading" class="md-nav__link">
|
||||
Upgrading
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</li>
|
||||
|
|
@ -463,6 +475,19 @@
|
|||
Session Affinity
|
||||
</a>
|
||||
|
||||
<nav class="md-nav">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#cookie-affinity" title="Cookie affinity" class="md-nav__link">
|
||||
Cookie affinity
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
|
|
@ -612,8 +637,8 @@
|
|||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#redirect-from-to-www" title="Redirect from to www" class="md-nav__link">
|
||||
Redirect from to www
|
||||
<a href="#redirect-fromto-www" title="Redirect from/to www." class="md-nav__link">
|
||||
Redirect from/to www.
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
|
@ -623,13 +648,6 @@
|
|||
Whitelist source range
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#cookie-affinity" title="Cookie affinity" class="md-nav__link">
|
||||
Cookie affinity
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
|
|
@ -783,6 +801,18 @@
|
|||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../default-backend/" title="Default backend" class="md-nav__link">
|
||||
Default backend
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../exposing-tcp-udp-services/" title="Exposing TCP and UDP services" class="md-nav__link">
|
||||
Exposing TCP and UDP services
|
||||
|
|
@ -820,8 +850,8 @@
|
|||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../multiple-ingress/" title="Multiple ingress controllers" class="md-nav__link">
|
||||
Multiple ingress controllers
|
||||
<a href="../../multiple-ingress/" title="Multiple Ingress controllers" class="md-nav__link">
|
||||
Multiple Ingress controllers
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
|
@ -844,8 +874,8 @@
|
|||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../tls/" title="TLS" class="md-nav__link">
|
||||
TLS
|
||||
<a href="../../tls/" title="TLS/HTTPS" class="md-nav__link">
|
||||
TLS/HTTPS
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
|
@ -857,13 +887,13 @@
|
|||
|
||||
<li class="md-nav__item md-nav__item--nested">
|
||||
|
||||
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-3-10" type="checkbox" id="nav-3-10">
|
||||
<input class="md-toggle md-nav__toggle" data-md-toggle="nav-3-11" type="checkbox" id="nav-3-11">
|
||||
|
||||
<label class="md-nav__link" for="nav-3-10">
|
||||
<label class="md-nav__link" for="nav-3-11">
|
||||
Third party addons
|
||||
</label>
|
||||
<nav class="md-nav" data-md-component="collapsible" data-md-level="2">
|
||||
<label class="md-nav__title" for="nav-3-10">
|
||||
<label class="md-nav__title" for="nav-3-11">
|
||||
Third party addons
|
||||
</label>
|
||||
<ul class="md-nav__list" data-md-scrollfix>
|
||||
|
|
@ -928,8 +958,8 @@
|
|||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../../examples/PREREQUISITES/" title="Prerequisites" class="md-nav__link">
|
||||
Prerequisites
|
||||
<a href="../../../examples/" title="Ingress examples" class="md-nav__link">
|
||||
Ingress examples
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
|
@ -940,8 +970,8 @@
|
|||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../../examples/README/" title="Ingress examples" class="md-nav__link">
|
||||
Ingress examples
|
||||
<a href="../../../examples/PREREQUISITES/" title="Prerequisites" class="md-nav__link">
|
||||
Prerequisites
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
|
@ -1013,6 +1043,18 @@
|
|||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../../examples/auth/oauth-external-auth/README/" title="External Authentication" class="md-nav__link">
|
||||
External Authentication
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
</li>
|
||||
|
|
@ -1103,8 +1145,8 @@
|
|||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../../examples/customization/custom-vts-metrics-prometheus/README/" title="Deploying the Nginx Ingress controller" class="md-nav__link">
|
||||
Deploying the Nginx Ingress controller
|
||||
<a href="../../../examples/customization/custom-vts-metrics-prometheus/README/" title="Custom VTS metrics with Prometheus" class="md-nav__link">
|
||||
Custom VTS metrics with Prometheus
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
|
@ -1127,8 +1169,8 @@
|
|||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../../examples/customization/ssl-dh-param/README/" title="Deploying the Nginx Ingress controller" class="md-nav__link">
|
||||
Deploying the Nginx Ingress controller
|
||||
<a href="../../../examples/customization/ssl-dh-param/README/" title="Custom DH parameters for perfect forward secrecy" class="md-nav__link">
|
||||
Custom DH parameters for perfect forward secrecy
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
|
@ -1167,18 +1209,6 @@
|
|||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../../examples/external-auth/README/" title="External Authentication" class="md-nav__link">
|
||||
External Authentication
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="../../../examples/multi-tls/README/" title="Multi TLS certificate termination" class="md-nav__link">
|
||||
Multi TLS certificate termination
|
||||
|
|
@ -1295,6 +1325,19 @@
|
|||
Session Affinity
|
||||
</a>
|
||||
|
||||
<nav class="md-nav">
|
||||
<ul class="md-nav__list">
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#cookie-affinity" title="Cookie affinity" class="md-nav__link">
|
||||
Cookie affinity
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
|
|
@ -1444,8 +1487,8 @@
|
|||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#redirect-from-to-www" title="Redirect from to www" class="md-nav__link">
|
||||
Redirect from to www
|
||||
<a href="#redirect-fromto-www" title="Redirect from/to www." class="md-nav__link">
|
||||
Redirect from/to www.
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
|
@ -1455,13 +1498,6 @@
|
|||
Whitelist source range
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
<a href="#cookie-affinity" title="Cookie affinity" class="md-nav__link">
|
||||
Cookie affinity
|
||||
</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="md-nav__item">
|
||||
|
|
@ -1561,6 +1597,13 @@
|
|||
Other types, such as boolean or numeric values must be quoted,
|
||||
i.e. <code class="codehilite">"true"</code>, <code class="codehilite">"false"</code>, <code class="codehilite">"100"</code>.</p>
|
||||
</div>
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">Note</p>
|
||||
<p>The annotation prefix can be changed using the
|
||||
<a href="../../cli-arguments/"><code class="codehilite">--annotations-prefix</code> command line argument</a>,
|
||||
but the default is <code class="codehilite">nginx.ingress.kubernetes.io</code>, as described in the
|
||||
table below.</p>
|
||||
</div>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -1825,11 +1868,28 @@ Set the annotation <code class="codehilite">nginx.ingress.kubernetes.io/rewrite-
|
|||
<p>If the application contains relative links it is possible to add an additional annotation <code class="codehilite">nginx.ingress.kubernetes.io/add-base-url</code> that will prepend a <a href="https://developer.mozilla.org/en/docs/Web/HTML/Element/base"><code class="codehilite">base</code> tag</a> in the header of the returned HTML from the backend.</p>
|
||||
<p>If the scheme of <a href="https://developer.mozilla.org/en/docs/Web/HTML/Element/base"><code class="codehilite">base</code> tag</a> need to be specific, set the annotation <code class="codehilite">nginx.ingress.kubernetes.io/base-url-scheme</code> to the scheme such as <code class="codehilite">http</code> and <code class="codehilite">https</code>.</p>
|
||||
<p>If the Application Root is exposed in a different path and needs to be redirected, set the annotation <code class="codehilite">nginx.ingress.kubernetes.io/app-root</code> to redirect requests for <code class="codehilite">/</code>.</p>
|
||||
<div class="admonition example">
|
||||
<p class="admonition-title">Example</p>
|
||||
<p>Please check the <a href="../../../examples/rewrite/README/">rewrite</a> example.</p>
|
||||
</div>
|
||||
<h3 id="session-affinity">Session Affinity<a class="headerlink" href="#session-affinity" title="Permanent link">¶</a></h3>
|
||||
<p>The annotation <code class="codehilite">nginx.ingress.kubernetes.io/affinity</code> enables and sets the affinity type in all Upstreams of an Ingress. This way, a request will always be directed to the same upstream server.
|
||||
The only affinity type available for NGINX is <code class="codehilite">cookie</code>.</p>
|
||||
<div class="admonition example">
|
||||
<p class="admonition-title">Example</p>
|
||||
<p>Please check the <a href="../../../examples/affinity/cookie/README/">affinity</a> example.</p>
|
||||
</div>
|
||||
<h4 id="cookie-affinity">Cookie affinity<a class="headerlink" href="#cookie-affinity" title="Permanent link">¶</a></h4>
|
||||
<p>If you use the <code class="codehilite">cookie</code> affinity type you can also specify the name of the cookie that will be used to route the requests with the annotation <code class="codehilite">nginx.ingress.kubernetes.io/session-cookie-name</code>. The default is to create a cookie named 'INGRESSCOOKIE'.</p>
|
||||
<p>In case of NGINX the annotation <code class="codehilite">nginx.ingress.kubernetes.io/session-cookie-hash</code> defines which algorithm will be used to hash the used upstream. Default value is <code class="codehilite">md5</code> and possible values are <code class="codehilite">md5</code>, <code class="codehilite">sha1</code> and <code class="codehilite">index</code>.</p>
|
||||
<div class="admonition attention">
|
||||
<p class="admonition-title">Attention</p>
|
||||
<p>The <code class="codehilite">index</code> option is not an actual hash; an in-memory index is used instead, which has less overhead.
|
||||
However, with <code class="codehilite">index</code>, matching against a changing upstream server list is inconsistent.
|
||||
So, at reload, if upstream servers have changed, index values are not guaranteed to correspond to the same server as before!
|
||||
<strong>Use <code class="codehilite">index</code> with caution</strong> and only if you need to!</p>
|
||||
</div>
|
||||
<p>In NGINX this feature is implemented by the third party module <a href="https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng">nginx-sticky-module-ng</a>. The workflow used to define which upstream server will be used is explained <a href="https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/raw/08a395c66e425540982c00482f55034e1fee67b6/docs/sticky.pdf">here</a></p>
|
||||
<h3 id="authentication">Authentication<a class="headerlink" href="#authentication" title="Permanent link">¶</a></h3>
|
||||
<p>Is possible to add authentication adding additional annotations in the Ingress rule. The source of the authentication is a secret that contains usernames and passwords inside the key <code class="codehilite">auth</code>.</p>
|
||||
<p>The annotations are:</p>
|
||||
|
|
@ -1848,7 +1908,10 @@ This annotation also accepts the alternative form "namespace/secretName", in whi
|
|||
</pre></div>
|
||||
|
||||
|
||||
<div class="admonition example">
|
||||
<p class="admonition-title">Example</p>
|
||||
<p>Please check the <a href="../../../examples/auth/basic/README/">auth</a> example.</p>
|
||||
</div>
|
||||
<h3 id="custom-nginx-upstream-checks">Custom NGINX upstream checks<a class="headerlink" href="#custom-nginx-upstream-checks" title="Permanent link">¶</a></h3>
|
||||
<p>NGINX exposes some flags in the <a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html#upstream">upstream configuration</a> that enable the configuration of each server in the upstream. The Ingress controller allows custom <code class="codehilite">max_fails</code> and <code class="codehilite">fail_timeout</code> parameters in a global context using <code class="codehilite">upstream-max-fails</code> and <code class="codehilite">upstream-fail-timeout</code> in the NGINX ConfigMap or in a particular Ingress rule. <code class="codehilite">upstream-max-fails</code> defaults to 0. This means NGINX will respect the container's <code class="codehilite">readinessProbe</code> if it is defined. If there is no probe and no values for <code class="codehilite">upstream-max-fails</code> NGINX will continue to send traffic to the container.</p>
|
||||
<div class="admonition tip">
|
||||
|
|
@ -1859,11 +1922,15 @@ This annotation also accepts the alternative form "namespace/secretName", in whi
|
|||
<p><code class="codehilite">nginx.ingress.kubernetes.io/upstream-max-fails</code>: number of unsuccessful attempts to communicate with the server that should occur in the duration set by the <code class="codehilite">upstream-fail-timeout</code> parameter to consider the server unavailable.</p>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/upstream-fail-timeout</code>: time in seconds during which the specified number of unsuccessful attempts to communicate with the server should occur to consider the server unavailable. This is also the period of time the server will be considered unavailable.</p>
|
||||
<p>In NGINX, backend server pools are called "<a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html">upstreams</a>". Each upstream contains the endpoints for a service. An upstream is created for each service that has Ingress rules defined.</p>
|
||||
<div class="admonition important">
|
||||
<p class="admonition-title">Important</p>
|
||||
<p>All Ingress rules using the same service will use the same upstream. Only one of the Ingress rules should define annotations to configure the upstream servers.</p>
|
||||
<div class="admonition attention">
|
||||
<p class="admonition-title">Attention</p>
|
||||
<p>All Ingress rules using the same service will use the same upstream.<br />
|
||||
Only one of the Ingress rules should define annotations to configure the upstream servers.</p>
|
||||
</div>
|
||||
<div class="admonition example">
|
||||
<p class="admonition-title">Example</p>
|
||||
<p>Please check the <a href="../../../examples/customization/custom-upstream-check/README/">custom upstream check</a> example.</p>
|
||||
</div>
|
||||
<h3 id="custom-nginx-upstream-hashing">Custom NGINX upstream hashing<a class="headerlink" href="#custom-nginx-upstream-hashing" title="Permanent link">¶</a></h3>
|
||||
<p>NGINX supports load balancing by client-server mapping based on <a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html#hash">consistent hashing</a> for a given key. The key can contain text, variables or any combination thereof. This feature allows for request stickiness other than client IP or cookies. The <a href="http://www.last.fm/user/RJ/journal/2007/04/10/392555/">ketama</a> consistent hashing method will be used which ensures only a few keys would be remapped to different servers on upstream group changes.</p>
|
||||
<p>To enable consistent hashing for a backend:</p>
|
||||
|
|
@ -1878,37 +1945,26 @@ This annotation also accepts the alternative form "namespace/secretName", in whi
|
|||
<h3 id="client-certificate-authentication">Client Certificate Authentication<a class="headerlink" href="#client-certificate-authentication" title="Permanent link">¶</a></h3>
|
||||
<p>It is possible to enable Client Certificate Authentication using additional annotations in Ingress Rule.</p>
|
||||
<p>The annotations are:</p>
|
||||
<div class="codehilite"><pre><span></span>nginx.ingress.kubernetes.io/auth-tls-secret: secretName
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p>The name of the Secret that contains the full Certificate Authority chain <code class="codehilite">ca.crt</code> that is enabled to authenticate against this Ingress.
|
||||
This annotation also accepts the alternative form "namespace/secretName", in which case the Secret lookup is performed in the referenced namespace instead of the Ingress namespace.</p>
|
||||
<div class="codehilite"><pre><span></span>nginx.ingress.kubernetes.io/auth-tls-verify-depth
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p>The validation depth between the provided client certificate and the Certification Authority chain.</p>
|
||||
<div class="codehilite"><pre><span></span>nginx.ingress.kubernetes.io/auth-tls-verify-client
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p>Enables verification of client certificates.</p>
|
||||
<div class="codehilite"><pre><span></span>nginx.ingress.kubernetes.io/auth-tls-error-page
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p>The URL/Page that user should be redirected in case of a Certificate Authentication Error</p>
|
||||
<div class="codehilite"><pre><span></span>nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p>Indicates if the received certificates should be passed or not to the upstream server.
|
||||
By default this is disabled.</p>
|
||||
<ul>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-tls-secret: secretName</code>:
|
||||
The name of the Secret that contains the full Certificate Authority chain <code class="codehilite">ca.crt</code> that is enabled to authenticate against this Ingress.
|
||||
This annotation also accepts the alternative form "namespace/secretName", in which case the Secret lookup is performed in the referenced namespace instead of the Ingress namespace.</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-tls-verify-depth</code>:
|
||||
The validation depth between the provided client certificate and the Certification Authority chain.</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-tls-verify-client</code>:
|
||||
Enables verification of client certificates.</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-tls-error-page</code>:
|
||||
The URL/Page that user should be redirected in case of a Certificate Authentication Error</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-tls-pass-certificate-to-upstream</code>:
|
||||
Indicates if the received certificates should be passed or not to the upstream server. By default this is disabled.</li>
|
||||
</ul>
|
||||
<div class="admonition example">
|
||||
<p class="admonition-title">Example</p>
|
||||
<p>Please check the <a href="../../../examples/auth/client-certs/README/">client-certs</a> example.</p>
|
||||
<div class="admonition important">
|
||||
<p class="admonition-title">Important</p>
|
||||
<p>TLS with Client Authentication is NOT possible in Cloudflare as is not allowed it and might result in unexpected behavior.</p>
|
||||
</div>
|
||||
<div class="admonition attention">
|
||||
<p class="admonition-title">Attention</p>
|
||||
<p>TLS with Client Authentication is <strong>not</strong> possible in Cloudflare and might result in unexpected behavior.</p>
|
||||
<p>Cloudflare only allows Authenticated Origin Pulls and is required to use their own certificate: <a href="https://blog.cloudflare.com/protecting-the-origin-with-tls-authenticated-origin-pulls/">https://blog.cloudflare.com/protecting-the-origin-with-tls-authenticated-origin-pulls/</a></p>
|
||||
<p>Only Authenticated Origin Pulls are allowed and can be configured by following their tutorial: <a href="https://support.cloudflare.com/hc/en-us/articles/204494148-Setting-up-NGINX-to-use-TLS-Authenticated-Origin-Pulls">https://support.cloudflare.com/hc/en-us/articles/204494148-Setting-up-NGINX-to-use-TLS-Authenticated-Origin-Pulls</a></p>
|
||||
</div>
|
||||
|
|
@ -1920,40 +1976,58 @@ By default this is disabled.</p>
|
|||
|
||||
|
||||
<h3 id="default-backend">Default Backend<a class="headerlink" href="#default-backend" title="Permanent link">¶</a></h3>
|
||||
<p>The ingress controller requires a default backend. This service handles the response when the service in the Ingress rule does not have endpoints.
|
||||
<p>The ingress controller requires a <a href="../../default-backend/">default backend</a>.
|
||||
This service handles the response when the service in the Ingress rule does not have endpoints.
|
||||
This is a global configuration for the ingress controller. In some cases could be required to return a custom content or format. In this scenario we can use the annotation <code class="codehilite">nginx.ingress.kubernetes.io/default-backend: <svc name></code> to specify a custom default backend.</p>
|
||||
<h3 id="enable-cors">Enable CORS<a class="headerlink" href="#enable-cors" title="Permanent link">¶</a></h3>
|
||||
<p>To enable Cross-Origin Resource Sharing (CORS) in an Ingress rule add the annotation <code class="codehilite">nginx.ingress.kubernetes.io/enable-cors: "true"</code>. This will add a section in the server location enabling this functionality.</p>
|
||||
<p>To enable Cross-Origin Resource Sharing (CORS) in an Ingress rule,
|
||||
add the annotation <code class="codehilite">nginx.ingress.kubernetes.io/enable-cors: "true"</code>.
|
||||
This will add a section in the server location enabling this functionality.</p>
|
||||
<p>CORS can be controlled with the following annotations:</p>
|
||||
<ul>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-methods</code> controls which methods are accepted. This is a multi-valued field, separated by ',' and accepts only letters (upper and lower case).</li>
|
||||
<li>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-methods</code>
|
||||
controls which methods are accepted.
|
||||
This is a multi-valued field, separated by ',' and accepts only letters (upper and lower case).
|
||||
Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, OPTIONS"</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-headers</code>
|
||||
controls which headers are accepted.
|
||||
This is a multi-valued field, separated by ',' and accepts letters, numbers, _ and -.
|
||||
Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-headers: "X-Forwarded-For, X-app123-XPTO"</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-origin</code>
|
||||
controls what's the accepted Origin for CORS and defaults to '*'.
|
||||
This is a single field value, with the following format: <code class="codehilite">http(s)://origin-site.com</code> or <code class="codehilite">http(s)://origin-site.com:port</code>
|
||||
Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-origin: "https://origin-site.com:4443"</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-credentials</code>
|
||||
controls if credentials can be passed during CORS operations.
|
||||
Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-credentials: "true"</code></p>
|
||||
</li>
|
||||
<li>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/cors-max-age</code>
|
||||
controls how long preflight requests can be cached.
|
||||
Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-max-age: 600</code></p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, OPTIONS"</code></p>
|
||||
<ul>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-headers</code> controls which headers are accepted. This is a multi-valued field, separated by ',' and accepts letters, numbers, _ and -.</li>
|
||||
</ul>
|
||||
<p>Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-headers: "X-Forwarded-For, X-app123-XPTO"</code></p>
|
||||
<ul>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-origin</code> controls what's the accepted Origin for CORS and defaults to '*'. This is a single field value, with the following format: http(s)://origin-site.com or http(s)://origin-site.com:port</li>
|
||||
</ul>
|
||||
<p>Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-origin: "https://origin-site.com:4443"</code></p>
|
||||
<ul>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-credentials</code> controls if credentials can be passed during CORS operations.</li>
|
||||
</ul>
|
||||
<p>Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-allow-credentials: "true"</code></p>
|
||||
<ul>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/cors-max-age</code> controls how long preflight requests can be cached.</li>
|
||||
</ul>
|
||||
<p>Example: <code class="codehilite">nginx.ingress.kubernetes.io/cors-max-age: 600</code></p>
|
||||
<p>For more information please see <a href="https://enable-cors.org/server_nginx.html">https://enable-cors.org</a></p>
|
||||
<h3 id="server-alias">Server Alias<a class="headerlink" href="#server-alias" title="Permanent link">¶</a></h3>
|
||||
<p>To add Server Aliases to an Ingress rule add the annotation <code class="codehilite">nginx.ingress.kubernetes.io/server-alias: "<alias>"</code>.
|
||||
This will create a server with the same configuration, but a different server_name as the provided host.</p>
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">Note</p>
|
||||
<p>A server-alias name cannot conflict with the hostname of an existing server. If it does the server-alias annotation will be ignored. If a server-alias is created and later a new server with the same hostname is created the new server configuration will take place over the alias configuration.</p>
|
||||
<p>For more information please see <a href="https://enable-cors.org/server_nginx.html">https://enable-cors.org</a></p>
|
||||
</div>
|
||||
<p>For more information please see <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name">http://nginx.org</a></p>
|
||||
<h3 id="server-alias">Server Alias<a class="headerlink" href="#server-alias" title="Permanent link">¶</a></h3>
|
||||
<p>To add Server Aliases to an Ingress rule add the annotation <code class="codehilite">nginx.ingress.kubernetes.io/server-alias: "<alias>"</code>.
|
||||
This will create a server with the same configuration, but a different <code class="codehilite">server_name</code> as the provided host.</p>
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">Note</p>
|
||||
<p>A server-alias name cannot conflict with the hostname of an existing server. If it does the server-alias annotation will be ignored.
|
||||
If a server-alias is created and later a new server with the same hostname is created,
|
||||
the new server configuration will take place over the alias configuration.</p>
|
||||
</div>
|
||||
<p>For more information please see <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#server_name">the <code class="codehilite">server_name</code> documentation</a>.</p>
|
||||
<h3 id="server-snippet">Server snippet<a class="headerlink" href="#server-snippet" title="Permanent link">¶</a></h3>
|
||||
<p>Using the annotation <code class="codehilite">nginx.ingress.kubernetes.io/server-snippet</code> it is possible to add custom configuration in the server configuration block.</p>
|
||||
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">apiVersion</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">extensions/v1beta1</span>
|
||||
|
|
@ -1973,17 +2047,21 @@ This will create a server with the same configuration, but a different server_na
|
|||
</pre></div>
|
||||
|
||||
|
||||
<div class="admonition important">
|
||||
<p class="admonition-title">Important</p>
|
||||
<p>This annotation can be used only once per host</p>
|
||||
<div class="admonition attention">
|
||||
<p class="admonition-title">Attention</p>
|
||||
<p>This annotation can be used only once per host.</p>
|
||||
</div>
|
||||
<h3 id="client-body-buffer-size">Client Body Buffer Size<a class="headerlink" href="#client-body-buffer-size" title="Permanent link">¶</a></h3>
|
||||
<p>Sets buffer size for reading client request body per location. In case the request body is larger than the buffer,
|
||||
the whole body or only its part is written to a temporary file. By default, buffer size is equal to two memory pages.
|
||||
This is 8K on x86, other 32-bit platforms, and x86-64. It is usually 16K on other 64-bit platforms. This annotation is
|
||||
applied to each location provided in the ingress rule.</p>
|
||||
<p><strong>Note:</strong> The annotation value must be given in a valid format otherwise the
|
||||
For example to set the client-body-buffer-size the following can be done:</p>
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">Note</p>
|
||||
<p>The annotation value must be given in a format understood by Nginx.</p>
|
||||
</div>
|
||||
<div class="admonition example">
|
||||
<p class="admonition-title">Example</p>
|
||||
<ul>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/client-body-buffer-size: "1000"</code> # 1000 bytes</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/client-body-buffer-size: 1k</code> # 1 kilobyte</li>
|
||||
|
|
@ -1991,6 +2069,7 @@ For example to set the client-body-buffer-size the following can be done:</p>
|
|||
<li><code class="codehilite">nginx.ingress.kubernetes.io/client-body-buffer-size: 1m</code> # 1 megabyte</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/client-body-buffer-size: 1M</code> # 1 megabyte</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p>For more information please see <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#client_body_buffer_size">http://nginx.org</a></p>
|
||||
<h3 id="external-authentication">External Authentication<a class="headerlink" href="#external-authentication" title="Permanent link">¶</a></h3>
|
||||
<p>To use an existing service that provides authentication the Ingress rule can be annotated with <code class="codehilite">nginx.ingress.kubernetes.io/auth-url</code> to indicate the URL where the HTTP request should be sent.</p>
|
||||
|
|
@ -1999,45 +2078,63 @@ For example to set the client-body-buffer-size the following can be done:</p>
|
|||
|
||||
|
||||
<p>Additionally it is possible to set:</p>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/auth-method</code>: <code class="codehilite"><Method></code> to specify the HTTP method to use.</p>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/auth-signin</code>: <code class="codehilite"><SignIn_URL></code> to specify the location of the error page.</p>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/auth-response-headers</code>: <code class="codehilite"><Response_Header_1, ..., Response_Header_n></code> to specify headers to pass to backend once authorization request completes.</p>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/auth-request-redirect</code>: <code class="codehilite"><Request_Redirect_URL></code> to specify the X-Auth-Request-Redirect header value.</p>
|
||||
<ul>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-method</code>:
|
||||
<code class="codehilite"><Method></code> to specify the HTTP method to use.</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-signin</code>:
|
||||
<code class="codehilite"><SignIn_URL></code> to specify the location of the error page.</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-response-headers</code>:
|
||||
<code class="codehilite"><Response_Header_1, ..., Response_Header_n></code> to specify headers to pass to backend once authorization request completes.</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/auth-request-redirect</code>:
|
||||
<code class="codehilite"><Request_Redirect_URL></code> to specify the X-Auth-Request-Redirect header value.</li>
|
||||
</ul>
|
||||
<div class="admonition example">
|
||||
<p class="admonition-title">Example</p>
|
||||
<p>Please check the <a href="../../../examples/auth/external-auth/README/">external-auth</a> example.</p>
|
||||
</div>
|
||||
<h3 id="rate-limiting">Rate limiting<a class="headerlink" href="#rate-limiting" title="Permanent link">¶</a></h3>
|
||||
<p>The annotations <code class="codehilite">nginx.ingress.kubernetes.io/limit-connections</code>, <code class="codehilite">nginx.ingress.kubernetes.io/limit-rps</code>, and <code class="codehilite">nginx.ingress.kubernetes.io/limit-rpm</code> define a limit on the connections that can be opened by a single client IP address. This can be used to mitigate <a href="https://www.nginx.com/blog/mitigating-ddos-attacks-with-nginx-and-nginx-plus">DDoS Attacks</a>.</p>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/limit-connections</code>: number of concurrent connections allowed from a single IP address.</p>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/limit-rps</code>: number of connections that may be accepted from a given IP each second.</p>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/limit-rpm</code>: number of connections that may be accepted from a given IP each minute.</p>
|
||||
<p>These annotations define a limit on the connections that can be opened by a single client IP address.
|
||||
This can be used to mitigate <a href="https://www.nginx.com/blog/mitigating-ddos-attacks-with-nginx-and-nginx-plus">DDoS Attacks</a>.</p>
|
||||
<ul>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-connections</code>: number of concurrent connections allowed from a single IP address.</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-rps</code>: number of connections that may be accepted from a given IP each second.</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-rpm</code>: number of connections that may be accepted from a given IP each minute.</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-rate-after</code>: sets the initial amount after which the further transmission of a response to a client will be rate limited.</li>
|
||||
<li><code class="codehilite">nginx.ingress.kubernetes.io/limit-rate</code>: rate of request that accepted from a client each second.</li>
|
||||
</ul>
|
||||
<p>You can specify the client IP source ranges to be excluded from rate-limiting through the <code class="codehilite">nginx.ingress.kubernetes.io/limit-whitelist</code> annotation. The value is a comma separated list of CIDRs.</p>
|
||||
<p>If you specify multiple annotations in a single Ingress rule, <code class="codehilite">limit-rpm</code>, and then <code class="codehilite">limit-rps</code> takes precedence.</p>
|
||||
<p>The annotation <code class="codehilite">nginx.ingress.kubernetes.io/limit-rate</code>, <code class="codehilite">nginx.ingress.kubernetes.io/limit-rate-after</code> define a limit the rate of response transmission to a client. The rate is specified in bytes per second. The zero value disables rate limiting. The limit is set per a request, and so if a client simultaneously opens two connections, the overall rate will be twice as much as the specified limit.</p>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/limit-rate-after</code>: sets the initial amount after which the further transmission of a response to a client will be rate limited.</p>
|
||||
<p><code class="codehilite">nginx.ingress.kubernetes.io/limit-rate</code>: rate of request that accepted from a client each second.</p>
|
||||
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">limit-rate-after</code> and <code class="codehilite">limit-rate</code> value may be set in the NGINX ConfigMap. if you set the value in ingress annotation will cover global setting.</p>
|
||||
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">limit-rate-after</code> and <code class="codehilite">limit-rate</code> value may be set in the <a href="../configmap/">NGINX ConfigMap</a>. if you set the value in ingress annotation will cover global setting.</p>
|
||||
<h3 id="permanent-redirect">Permanent Redirect<a class="headerlink" href="#permanent-redirect" title="Permanent link">¶</a></h3>
|
||||
<p>This annotation allows to return a permanent redirect instead of sending data to the upstream. For example <code class="codehilite">nginx.ingress.kubernetes.io/permanent-redirect: https://www.google.com</code> would redirect everything to Google.</p>
|
||||
<h3 id="ssl-passthrough">SSL Passthrough<a class="headerlink" href="#ssl-passthrough" title="Permanent link">¶</a></h3>
|
||||
<p>The annotation <code class="codehilite">nginx.ingress.kubernetes.io/ssl-passthrough</code> allows to configure TLS termination in the pod and not in NGINX.</p>
|
||||
<div class="admonition important">
|
||||
<p class="admonition-title">Important</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Using the annotation <code class="codehilite">nginx.ingress.kubernetes.io/ssl-passthrough</code> invalidates all the other available annotations. This is because SSL Passthrough works in L4 (TCP).</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>The use of this annotation requires Proxy Protocol to be enabled in the load-balancer. For example enabling Proxy Protocol for AWS ELB is described <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-proxy-protocol.html">here</a>. If you're using ingress-controller without load balancer then the flag <code class="codehilite">--enable-ssl-passthrough</code> is required (by default it is disabled).</p>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="admonition attention">
|
||||
<p class="admonition-title">Attention</p>
|
||||
<p>Using the annotation <code class="codehilite">nginx.ingress.kubernetes.io/ssl-passthrough</code> invalidates all the other available annotations.
|
||||
This is because SSL Passthrough works on level 4 of the OSI stack (TCP), not on the HTTP/HTTPS level.</p>
|
||||
</div>
|
||||
<div class="admonition attention">
|
||||
<p class="admonition-title">Attention</p>
|
||||
<p>The use of this annotation requires the Proxy Protocol to be enabled in the front-end load-balancer.
|
||||
For example enabling Proxy Protocol for AWS ELB is described <a href="https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-proxy-protocol.html">here</a>.
|
||||
If you're using ingress-controller without load balancer then the flag
|
||||
<code class="codehilite">--enable-ssl-passthrough</code> is required (by default it is disabled).</p>
|
||||
</div>
|
||||
<h3 id="secure-backends">Secure backends<a class="headerlink" href="#secure-backends" title="Permanent link">¶</a></h3>
|
||||
<p>By default NGINX uses <code class="codehilite">http</code> to reach the services. Adding the annotation <code class="codehilite">nginx.ingress.kubernetes.io/secure-backends: "true"</code> in the Ingress rule changes the protocol to <code class="codehilite">https</code>.
|
||||
<p>By default NGINX uses plain HTTP to reach the services.
|
||||
Adding the annotation <code class="codehilite">nginx.ingress.kubernetes.io/secure-backends: "true"</code> in the Ingress rule changes the protocol to HTTPS.
|
||||
If you want to validate the upstream against a specific certificate, you can create a secret with it and reference the secret with the annotation <code class="codehilite">nginx.ingress.kubernetes.io/secure-verify-ca-secret</code>.</p>
|
||||
<blockquote>
|
||||
<p>Note that if an invalid or non-existent secret is given, the NGINX ingress controller will ignore the <code class="codehilite">secure-backends</code> annotation.</p>
|
||||
</blockquote>
|
||||
<div class="admonition attention">
|
||||
<p class="admonition-title">Attention</p>
|
||||
<p>Note that if an invalid or non-existent secret is given,
|
||||
the ingress controller will ignore the <code class="codehilite">secure-backends</code> annotation.</p>
|
||||
</div>
|
||||
<h3 id="service-upstream">Service Upstream<a class="headerlink" href="#service-upstream" title="Permanent link">¶</a></h3>
|
||||
<p>By default the NGINX ingress controller uses a list of all endpoints (Pod IP/port) in the NGINX upstream configuration. This annotation disables that behavior and instead uses a single upstream in NGINX, the service's Cluster IP and port. This can be desirable for things like zero-downtime deployments as it reduces the need to reload NGINX configuration when Pods come up and down. See issue <a href="https://github.com/kubernetes/ingress-nginx/issues/257">#257</a>.</p>
|
||||
<p>By default the NGINX ingress controller uses a list of all endpoints (Pod IP/port) in the NGINX upstream configuration.</p>
|
||||
<p>The <code class="codehilite">nginx.ingress.kubernetes.io/service-upstream</code> annotation disables that behavior and instead uses a single upstream in NGINX, the service's Cluster IP and port.</p>
|
||||
<p>This can be desirable for things like zero-downtime deployments as it reduces the need to reload NGINX configuration when Pods come up and down. See issue <a href="https://github.com/kubernetes/ingress-nginx/issues/257">#257</a>.</p>
|
||||
<h4 id="known-issues">Known Issues<a class="headerlink" href="#known-issues" title="Permanent link">¶</a></h4>
|
||||
<p>If the <code class="codehilite">service-upstream</code> annotation is specified the following things should be taken into consideration:</p>
|
||||
<ul>
|
||||
|
|
@ -2045,25 +2142,28 @@ If you want to validate the upstream against a specific certificate, you can cre
|
|||
<li>The <code class="codehilite">proxy_next_upstream</code> directive will not have any effect meaning on error the request will not be dispatched to another upstream.</li>
|
||||
</ul>
|
||||
<h3 id="server-side-https-enforcement-through-redirect">Server-side HTTPS enforcement through redirect<a class="headerlink" href="#server-side-https-enforcement-through-redirect" title="Permanent link">¶</a></h3>
|
||||
<p>By default the controller redirects (301) to <code class="codehilite">HTTPS</code> if TLS is enabled for that ingress. If you want to disable that behavior globally, you can use <code class="codehilite">ssl-redirect: "false"</code> in the NGINX config map.</p>
|
||||
<p>To configure this feature for specific ingress resources, you can use the <code class="codehilite">nginx.ingress.kubernetes.io/ssl-redirect: "false"</code> annotation in the particular resource.</p>
|
||||
<p>When using SSL offloading outside of cluster (e.g. AWS ELB) it may be useful to enforce a redirect to <code class="codehilite">HTTPS</code> even when there is not TLS cert available. This can be achieved by using the <code class="codehilite">nginx.ingress.kubernetes.io/force-ssl-redirect: "true"</code> annotation in the particular resource.</p>
|
||||
<h3 id="redirect-from-to-www">Redirect from to www<a class="headerlink" href="#redirect-from-to-www" title="Permanent link">¶</a></h3>
|
||||
<p>In some scenarios is required to redirect from <code class="codehilite">www.domain.com</code> to <code class="codehilite">domain.com</code> or viceversa.
|
||||
<p>By default the controller redirects (308) to HTTPS if TLS is enabled for that ingress.
|
||||
If you want to disable this behavior globally, you can use <code class="codehilite">ssl-redirect: "false"</code> in the NGINX <a href="../configmap/">config map</a>.</p>
|
||||
<p>To configure this feature for specific ingress resources, you can use the <code class="codehilite">nginx.ingress.kubernetes.io/ssl-redirect: "false"</code>
|
||||
annotation in the particular resource.</p>
|
||||
<p>When using SSL offloading outside of cluster (e.g. AWS ELB) it may be useful to enforce a redirect to HTTPS
|
||||
even when there is no TLS certificate available.
|
||||
This can be achieved by using the <code class="codehilite">nginx.ingress.kubernetes.io/force-ssl-redirect: "true"</code> annotation in the particular resource.</p>
|
||||
<h3 id="redirect-fromto-www">Redirect from/to www.<a class="headerlink" href="#redirect-fromto-www" title="Permanent link">¶</a></h3>
|
||||
<p>In some scenarios is required to redirect from <code class="codehilite">www.domain.com</code> to <code class="codehilite">domain.com</code> or vice versa.
|
||||
To enable this feature use the annotation <code class="codehilite">nginx.ingress.kubernetes.io/from-to-www-redirect: "true"</code></p>
|
||||
<div class="admonition important">
|
||||
<p class="admonition-title">Important</p>
|
||||
<div class="admonition attention">
|
||||
<p class="admonition-title">Attention</p>
|
||||
<p>If at some point a new Ingress is created with a host equal to one of the options (like <code class="codehilite">domain.com</code>) the annotation will be omitted.</p>
|
||||
</div>
|
||||
<h3 id="whitelist-source-range">Whitelist source range<a class="headerlink" href="#whitelist-source-range" title="Permanent link">¶</a></h3>
|
||||
<p>You can specify the allowed client IP source ranges through the <code class="codehilite">nginx.ingress.kubernetes.io/whitelist-source-range</code> annotation. The value is a comma separated list of <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">CIDRs</a>, e.g. <code class="codehilite">10.0.0.0/24,172.10.0.1</code>.</p>
|
||||
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">whitelist-source-range</code> value may be set in the NGINX ConfigMap.</p>
|
||||
<p><strong>Note:</strong> Adding an annotation to an Ingress rule overrides any global restriction.</p>
|
||||
<h3 id="cookie-affinity">Cookie affinity<a class="headerlink" href="#cookie-affinity" title="Permanent link">¶</a></h3>
|
||||
<p>If you use the <code class="codehilite">cookie</code> type you can also specify the name of the cookie that will be used to route the requests with the annotation <code class="codehilite">nginx.ingress.kubernetes.io/session-cookie-name</code>. The default is to create a cookie named 'INGRESSCOOKIE'.</p>
|
||||
<p>In case of NGINX the annotation <code class="codehilite">nginx.ingress.kubernetes.io/session-cookie-hash</code> defines which algorithm will be used to 'hash' the used upstream. Default value is <code class="codehilite">md5</code> and possible values are <code class="codehilite">md5</code>, <code class="codehilite">sha1</code> and <code class="codehilite">index</code>.
|
||||
The <code class="codehilite">index</code> option is not hashed, an in-memory index is used instead, it's quicker and the overhead is shorter Warning: the matching against upstream servers list is inconsistent. So, at reload, if upstreams servers has changed, index values are not guaranteed to correspond to the same server as before! <strong>USE IT WITH CAUTION</strong> and only if you need to!</p>
|
||||
<p>In NGINX this feature is implemented by the third party module <a href="https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng">nginx-sticky-module-ng</a>. The workflow used to define which upstream server will be used is explained <a href="https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/raw/08a395c66e425540982c00482f55034e1fee67b6/docs/sticky.pdf">here</a></p>
|
||||
<p>You can specify allowed client IP source ranges through the <code class="codehilite">nginx.ingress.kubernetes.io/whitelist-source-range</code> annotation.
|
||||
The value is a comma separated list of <a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing">CIDRs</a>, e.g. <code class="codehilite">10.0.0.0/24,172.10.0.1</code>.</p>
|
||||
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">whitelist-source-range</code> value may be set in the <a href="../configmap/">NGINX ConfigMap</a>.</p>
|
||||
<div class="admonition note">
|
||||
<p class="admonition-title">Note</p>
|
||||
<p>Adding an annotation to an Ingress rule overrides any global restriction.</p>
|
||||
</div>
|
||||
<h3 id="custom-timeouts">Custom timeouts<a class="headerlink" href="#custom-timeouts" title="Permanent link">¶</a></h3>
|
||||
<p>Using the configuration configmap it is possible to set the default global timeout for connections to the upstream servers.
|
||||
In some scenarios is required to have different values. To allow this we provide annotations that allows this customization:</p>
|
||||
|
|
@ -2076,13 +2176,12 @@ In some scenarios is required to have different values. To allow this we provide
|
|||
<li><code class="codehilite">nginx.ingress.kubernetes.io/proxy-request-buffering</code></li>
|
||||
</ul>
|
||||
<h3 id="proxy-redirect">Proxy redirect<a class="headerlink" href="#proxy-redirect" title="Permanent link">¶</a></h3>
|
||||
<p>With the annotations <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-from</code> and <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-to</code> it is possible to set the text that should be changed in the <code class="codehilite">Location</code> and <code class="codehilite">Refresh</code> header fields of a proxied server response (http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect)
|
||||
Setting "off" or "default" in the annotation <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-from</code> disables <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-to</code>
|
||||
Both annotations will be used in any other case
|
||||
By default the value is "off".</p>
|
||||
<p>With the annotations <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-from</code> and <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-to</code> it is possible to set the text that should be changed in the <code class="codehilite">Location</code> and <code class="codehilite">Refresh</code> header fields of a proxied server response (http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect)</p>
|
||||
<p>Setting "off" or "default" in the annotation <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-from</code> disables <code class="codehilite">nginx.ingress.kubernetes.io/proxy-redirect-to</code>.</p>
|
||||
<p>Both annotations will be used in any other case. By default the value is "off".</p>
|
||||
<h3 id="custom-max-body-size">Custom max body size<a class="headerlink" href="#custom-max-body-size" title="Permanent link">¶</a></h3>
|
||||
<p>For NGINX, 413 error will be returned to the client when the size in a request exceeds the maximum allowed size of the client request body. This size can be configured by the parameter <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size"><code class="codehilite">client_max_body_size</code></a>.</p>
|
||||
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">proxy-body-size</code> value may be set in the NGINX ConfigMap.
|
||||
<p>For NGINX, an 413 error will be returned to the client when the size in a request exceeds the maximum allowed size of the client request body. This size can be configured by the parameter <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size"><code class="codehilite">client_max_body_size</code></a>.</p>
|
||||
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">proxy-body-size</code> value may be set in the <a href="../configmap/">NGINX ConfigMap</a>.
|
||||
To use custom values in an Ingress rule define these annotation:</p>
|
||||
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">nginx.ingress.kubernetes.io/proxy-body-size</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">8m</span>
|
||||
</pre></div>
|
||||
|
|
@ -2090,8 +2189,8 @@ To use custom values in an Ingress rule define these annotation:</p>
|
|||
|
||||
<h3 id="proxy-buffering">Proxy buffering<a class="headerlink" href="#proxy-buffering" title="Permanent link">¶</a></h3>
|
||||
<p>Enable or disable proxy buffering <a href="http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering"><code class="codehilite">proxy_buffering</code></a>.
|
||||
By default proxy buffering is disabled in the nginx config.</p>
|
||||
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">proxy-buffering</code> value may be set in the NGINX ConfigMap.
|
||||
By default proxy buffering is disabled in the NGINX config.</p>
|
||||
<p>To configure this setting globally for all Ingress rules, the <code class="codehilite">proxy-buffering</code> value may be set in the <a href="../configmap/">NGINX ConfigMap</a>.
|
||||
To use custom values in an Ingress rule define these annotation:</p>
|
||||
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">nginx.ingress.kubernetes.io/proxy-buffering</span><span class="p p-Indicator">:</span> <span class="s">"on"</span>
|
||||
</pre></div>
|
||||
|
|
@ -2105,42 +2204,45 @@ To use custom values in an Ingress rule define these annotation:</p>
|
|||
|
||||
|
||||
<h3 id="connection-proxy-header">Connection proxy header<a class="headerlink" href="#connection-proxy-header" title="Permanent link">¶</a></h3>
|
||||
<p>Using this annotation will override the default connection header set by nginx. To use custom values in an Ingress rule, define the annotation:</p>
|
||||
<p>Using this annotation will override the default connection header set by NGINX.
|
||||
To use custom values in an Ingress rule, define the annotation:</p>
|
||||
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">nginx.ingress.kubernetes.io/connection-proxy-header</span><span class="p p-Indicator">:</span> <span class="s">"keep-alive"</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<h3 id="enable-access-log">Enable Access Log<a class="headerlink" href="#enable-access-log" title="Permanent link">¶</a></h3>
|
||||
<p>In some scenarios could be required to disable NGINX access logs. To enable this feature use the annotation:</p>
|
||||
<p>Access logs are enabled by default, but in some scenarios access logs might be required to be disabled for a given
|
||||
ingress. To do this, use the annotation:</p>
|
||||
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">nginx.ingress.kubernetes.io/enable-access-log</span><span class="p p-Indicator">:</span> <span class="s">"false"</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<h3 id="enable-rewrite-log">Enable Rewrite Log<a class="headerlink" href="#enable-rewrite-log" title="Permanent link">¶</a></h3>
|
||||
<p>In some scenarios it could be required to enable NGINX rewrite logs. Note that rewrite logs are sent to the error_log file at the notice level. To enable this feature use the annotation:</p>
|
||||
<p>Rewrite logs are not enabled by default. In some scenarios it could be required to enable NGINX rewrite logs.
|
||||
Note that rewrite logs are sent to the error_log file at the notice level. To enable this feature use the annotation:</p>
|
||||
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">nginx.ingress.kubernetes.io/enable-rewrite-log</span><span class="p p-Indicator">:</span> <span class="s">"true"</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<h3 id="lua-resty-waf">Lua Resty WAF<a class="headerlink" href="#lua-resty-waf" title="Permanent link">¶</a></h3>
|
||||
<p>Using <code class="codehilite">lua-resty-waf-*</code> annotations we can enable and control <a href="https://github.com/p0pr0ck5/lua-resty-waf">lua-resty-waf</a> per location.
|
||||
Following configuration will enable WAF for the paths defined in the corresponding ingress:</p>
|
||||
<p>Using <code class="codehilite">lua-resty-waf-*</code> annotations we can enable and control the <a href="https://github.com/p0pr0ck5/lua-resty-waf">lua-resty-waf</a>
|
||||
Web Application Firewall per location.</p>
|
||||
<p>Following configuration will enable the WAF for the paths defined in the corresponding ingress:</p>
|
||||
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">nginx.ingress.kubernetes.io/lua-resty-waf</span><span class="p p-Indicator">:</span> <span class="s">"active"</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p>In order to run it in debugging mode you can set <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf-debug</code> to <code class="codehilite">"true"</code> in addition to the above configuration.
|
||||
The other possible values for <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf</code> are <code class="codehilite">inactive</code> and <code class="codehilite">simulate</code>. In <code class="codehilite">inactive</code> mode WAF won't do anything, whereas
|
||||
in <code class="codehilite">simulate</code> mode it will log a warning message if there's a matching WAF rule for given request. This is useful to debug a rule and eliminate possible false positives before fully deploying it.</p>
|
||||
The other possible values for <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf</code> are <code class="codehilite">inactive</code> and <code class="codehilite">simulate</code>.
|
||||
In <code class="codehilite">inactive</code> mode WAF won't do anything, whereas in <code class="codehilite">simulate</code> mode it will log a warning message if there's a matching WAF rule for given request. This is useful to debug a rule and eliminate possible false positives before fully deploying it.</p>
|
||||
<p><code class="codehilite">lua-resty-waf</code> comes with predefined set of rules <a href="https://github.com/p0pr0ck5/lua-resty-waf/tree/84b4f40362500dd0cb98b9e71b5875cb1a40f1ad/rules">https://github.com/p0pr0ck5/lua-resty-waf/tree/84b4f40362500dd0cb98b9e71b5875cb1a40f1ad/rules</a> that covers ModSecurity CRS.
|
||||
You can use <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf-ignore-rulesets</code> to ignore subset of those rulesets. For an example:</p>
|
||||
You can use <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf-ignore-rulesets</code> to ignore a subset of those rulesets. For an example:</p>
|
||||
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">nginx.ingress.kubernetes.io/lua-resty-waf-ignore-rulesets</span><span class="p p-Indicator">:</span> <span class="s">"41000_sqli,</span><span class="nv"> </span><span class="s">42000_xss"</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p>will ignore the two mentioned rulesets.</p>
|
||||
<p>It is also possible to configure custom WAF rules per ingress using <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf-extra-rules</code> annotation. For an example the following snippet will
|
||||
configure a WAF rule to deny requests with query string value that contains word <code class="codehilite">foo</code>:</p>
|
||||
<p>It is also possible to configure custom WAF rules per ingress using the <code class="codehilite">nginx.ingress.kubernetes.io/lua-resty-waf-extra-rules</code> annotation. For an example the following snippet will configure a WAF rule to deny requests with query string value that contains word <code class="codehilite">foo</code>:</p>
|
||||
<div class="codehilite"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">nginx.ingress.kubernetes.io/lua-resty-waf-extra-rules</span><span class="p p-Indicator">:</span> <span class="s">'[=[</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">"access":</span><span class="nv"> </span><span class="s">[</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">"actions":</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">"disrupt"</span><span class="nv"> </span><span class="s">:</span><span class="nv"> </span><span class="s">"DENY"</span><span class="nv"> </span><span class="s">},</span><span class="nv"> </span><span class="s">"id":</span><span class="nv"> </span><span class="s">10001,</span><span class="nv"> </span><span class="s">"msg":</span><span class="nv"> </span><span class="s">"my</span><span class="nv"> </span><span class="s">custom</span><span class="nv"> </span><span class="s">rule",</span><span class="nv"> </span><span class="s">"operator":</span><span class="nv"> </span><span class="s">"STR_CONTAINS",</span><span class="nv"> </span><span class="s">"pattern":</span><span class="nv"> </span><span class="s">"foo",</span><span class="nv"> </span><span class="s">"vars":</span><span class="nv"> </span><span class="s">[</span><span class="nv"> </span><span class="s">{</span><span class="nv"> </span><span class="s">"parse":</span><span class="nv"> </span><span class="s">[</span><span class="nv"> </span><span class="s">"values",</span><span class="nv"> </span><span class="s">1</span><span class="nv"> </span><span class="s">],</span><span class="nv"> </span><span class="s">"type":</span><span class="nv"> </span><span class="s">"REQUEST_ARGS"</span><span class="nv"> </span><span class="s">}</span><span class="nv"> </span><span class="s">]</span><span class="nv"> </span><span class="s">}</span><span class="nv"> </span><span class="s">],</span><span class="nv"> </span><span class="s">"body_filter":</span><span class="nv"> </span><span class="s">[],</span><span class="nv"> </span><span class="s">"header_filter":[]</span><span class="nv"> </span><span class="s">}</span><span class="nv"> </span><span class="s">]=]'</span>
|
||||
</pre></div>
|
||||
|
||||
|
|
@ -2148,12 +2250,13 @@ configure a WAF rule to deny requests with query string value that contains word
|
|||
<p>For details on how to write WAF rules, please refer to <a href="https://github.com/p0pr0ck5/lua-resty-waf">https://github.com/p0pr0ck5/lua-resty-waf</a>.</p>
|
||||
<h3 id="grpc-backend">gRPC backend<a class="headerlink" href="#grpc-backend" title="Permanent link">¶</a></h3>
|
||||
<p>Since NGINX 1.13.10 it is possible to expose <a href="http://nginx.org/en/docs/http/ngx_http_grpc_module.html">gRPC services natively</a></p>
|
||||
<p>You only need to add the annotation <code class="codehilite">nginx.ingress.kubernetes.io/grpc-backend: "true"</code> to enable this feature. Additionally, if the gRPC service requires TLS <code class="codehilite">nginx.ingress.kubernetes.io/secure-backends: "true"</code></p>
|
||||
<div class="admonition important">
|
||||
<p class="admonition-title">Important</p>
|
||||
<p>This feature requires HTTP2 to work which means we need to expose this service using HTTPS.</p>
|
||||
<p>You only need to add the annotation <code class="codehilite">nginx.ingress.kubernetes.io/grpc-backend: "true"</code> to enable this feature.
|
||||
Additionally, if the gRPC service requires TLS, add <code class="codehilite">nginx.ingress.kubernetes.io/secure-backends: "true"</code>.</p>
|
||||
<div class="admonition attention">
|
||||
<p class="admonition-title">Attention</p>
|
||||
<p>This feature requires HTTP2 to work which means we need to expose this service using HTTPS.
|
||||
Exposing a gRPC service using HTTP is not supported.</p>
|
||||
</div>
|
||||
<p>Exposing a gRPC service using HTTP is not supported.</p>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue