Merge pull request #2372 from rajatjindal/affinity-doc-fix

fix the default cookie name in doc
This commit is contained in:
k8s-ci-robot 2018-04-18 14:29:00 -07:00 committed by GitHub
commit 396a19bc86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -9,7 +9,7 @@ Session stickiness is achieved through 3 annotations on the Ingress, as shown in
|Name|Description|Values| |Name|Description|Values|
| --- | --- | --- | | --- | --- | --- |
|nginx.ingress.kubernetes.io/affinity|Sets the affinity type|string (in NGINX only ``cookie`` is possible| |nginx.ingress.kubernetes.io/affinity|Sets the affinity type|string (in NGINX only ``cookie`` is possible|
|nginx.ingress.kubernetes.io/session-cookie-name|Name of the cookie that will be used|string (default to route)| |nginx.ingress.kubernetes.io/session-cookie-name|Name of the cookie that will be used|string (default to INGRESSCOOKIE)|
|nginx.ingress.kubernetes.io/session-cookie-hash|Type of hash that will be used in cookie value|sha1/md5/index| |nginx.ingress.kubernetes.io/session-cookie-hash|Type of hash that will be used in cookie value|sha1/md5/index|
You can create the ingress to test this You can create the ingress to test this
@ -36,7 +36,7 @@ Rules:
Annotations: Annotations:
affinity: cookie affinity: cookie
session-cookie-hash: sha1 session-cookie-hash: sha1
session-cookie-name: route session-cookie-name: INGRESSCOOKIE
Events: Events:
FirstSeen LastSeen Count From SubObjectPath Type Reason Message FirstSeen LastSeen Count From SubObjectPath Type Reason Message
--------- -------- ----- ---- ------------- -------- ------ ------- --------- -------- ----- ---- ------------- -------- ------ -------
@ -50,12 +50,12 @@ Date: Fri, 10 Feb 2017 14:11:12 GMT
Content-Type: text/html Content-Type: text/html
Content-Length: 612 Content-Length: 612
Connection: keep-alive Connection: keep-alive
Set-Cookie: route=a9907b79b248140b56bb13723f72b67697baac3d; Path=/; HttpOnly Set-Cookie: INGRESSCOOKIE=a9907b79b248140b56bb13723f72b67697baac3d; Path=/; HttpOnly
Last-Modified: Tue, 24 Jan 2017 14:02:19 GMT Last-Modified: Tue, 24 Jan 2017 14:02:19 GMT
ETag: "58875e6b-264" ETag: "58875e6b-264"
Accept-Ranges: bytes Accept-Ranges: bytes
``` ```
In the example above, you can see a line containing the 'Set-Cookie: route' setting the right defined stickiness cookie. In the example above, you can see a line containing the 'Set-Cookie: INGRESSCOOKIE' setting the right defined stickiness cookie.
This cookie is created by NGINX containing the hash of the used upstream in that request. This cookie is created by NGINX containing the hash of the used upstream in that request.
If the user changes this cookie, NGINX creates a new one and redirect the user to another upstream. If the user changes this cookie, NGINX creates a new one and redirect the user to another upstream.

View file

@ -394,7 +394,7 @@ To configure this setting globally for all Ingress rules, the `whitelist-source-
### Cookie affinity ### Cookie affinity
If you use the ``cookie`` type you can also specify the name of the cookie that will be used to route the requests with the annotation `nginx.ingress.kubernetes.io/session-cookie-name`. The default is to create a cookie named 'route'. If you use the ``cookie`` type you can also specify the name of the cookie that will be used to route the requests with the annotation `nginx.ingress.kubernetes.io/session-cookie-name`. The default is to create a cookie named 'INGRESSCOOKIE'.
In case of NGINX the annotation `nginx.ingress.kubernetes.io/session-cookie-hash` defines which algorithm will be used to 'hash' the used upstream. Default value is `md5` and possible values are `md5`, `sha1` and `index`. In case of NGINX the annotation `nginx.ingress.kubernetes.io/session-cookie-hash` defines which algorithm will be used to 'hash' the used upstream. Default value is `md5` and possible values are `md5`, `sha1` and `index`.
The `index` 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! USE IT WITH CAUTION and only if you need to! The `index` 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! USE IT WITH CAUTION and only if you need to!