</code></pre></div><h2id=validation>Validation<aclass=headerlinkhref=#validationtitle="Permanent link"> ¶</a></h2><p>You can confirm that the Ingress works:</p><divclass=highlight><pre><span></span><code><spanclass=gp>$ </span>kubectl<spanclass=w></span>describe<spanclass=w></span>ing<spanclass=w></span>nginx-test
</code></pre></div><p>In the example above, you can see that the response contains a <code>Set-Cookie</code> header with the settings we have defined. This cookie is created by the Ingress-Nginx Controller, it contains a randomly generated key corresponding to the upstream used for that request (selected using <ahref=https://en.wikipedia.org/wiki/Consistent_hashing>consistent hashing</a>) and has an <code>Expires</code> directive. If a client sends a cookie that doesn't correspond to an upstream, NGINX selects an upstream and creates a corresponding cookie.</p><p>If the backend pool grows NGINX will keep sending the requests through the same server of the first request, even if it's overloaded.</p><p>When the backend server is removed, the requests are re-routed to another upstream server. This does not require the cookie to be updated because the key's <ahref=https://en.wikipedia.org/wiki/Consistent_hashing>consistent hash</a> will change.</p><h2id=caveats>Caveats<aclass=headerlinkhref=#caveatstitle="Permanent link"> ¶</a></h2><p>When you have a Service pointing to more than one Ingress, with only one containing affinity configuration, the first created Ingress will be used. This means that you can face the situation that you've configured session affinity on one Ingress and it doesn't work because the Service is pointing to another Ingress that doesn't configure this.</p></article></div></div></main><footerclass=md-footer><divclass="md-footer-meta md-typeset"><divclass="md-footer-meta__inner md-grid"><divclass=md-copyright> Made with <ahref=https://squidfunk.github.io/mkdocs-material/target=_blankrel=noopener> Material for MkDocs </a></div></div></div></footer></div><divclass=md-dialogdata-md-component=dialog><divclass="md-dialog__inner md-typeset"></div></div><scriptid=__configtype=application/json>{"base":"../../..","features":["navigation.tabs","navigation.tabs.sticky","navigation.instant","navigation.sections"],"search":"../../../assets/javascripts/workers/search.f886a092.min.js","translations":{"clipboard.copied":"Copied to clipboard","clipboard.copy":"Copy to clipboard","search.result.more.one":"1 more on this page","search.result.more.other":"# more on this page","search.result.none":"No matching documents","search.result.one":"1 matching document","search.result.other":"# matching documents","search.result.placeholder":"Type to start searching","search.result.term.missing":"Missing","select.version":"Select version"}}</script><scriptsrc=../../../assets/javascripts/bundle.aecac24b.min.js></script></body></html>