Merge pull request #24756 from fonsecas72/95641
Documenting new default headers in HTTP probes
This commit is contained in:
+32
@@ -336,6 +336,8 @@ liveness. Minimum value is 1.
|
|||||||
try `failureThreshold` times before giving up. Giving up in case of liveness probe means restarting the container. In case of readiness probe the Pod will be marked Unready.
|
try `failureThreshold` times before giving up. Giving up in case of liveness probe means restarting the container. In case of readiness probe the Pod will be marked Unready.
|
||||||
Defaults to 3. Minimum value is 1.
|
Defaults to 3. Minimum value is 1.
|
||||||
|
|
||||||
|
### HTTP probes
|
||||||
|
|
||||||
[HTTP probes](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#httpgetaction-v1-core)
|
[HTTP probes](/docs/reference/generated/kubernetes-api/{{< param "version" >}}/#httpgetaction-v1-core)
|
||||||
have additional fields that can be set on `httpGet`:
|
have additional fields that can be set on `httpGet`:
|
||||||
|
|
||||||
@@ -357,6 +359,36 @@ and the Pod's `hostNetwork` field is true. Then `host`, under `httpGet`, should
|
|||||||
to 127.0.0.1. If your pod relies on virtual hosts, which is probably the more common
|
to 127.0.0.1. If your pod relies on virtual hosts, which is probably the more common
|
||||||
case, you should not use `host`, but rather set the `Host` header in `httpHeaders`.
|
case, you should not use `host`, but rather set the `Host` header in `httpHeaders`.
|
||||||
|
|
||||||
|
For an HTTP probe, the kubelet sends three request headers in addition to the mandatory `Host` header:
|
||||||
|
`User-Agent`, `Accept-Encoding` and `Accept`. The default values for these headers are `kube-probe/{{< skew latestVersion >}}`
|
||||||
|
(where `{{< skew latestVersion >}}` is the version of the kubelet ), `gzip` and `*/*` respectively.
|
||||||
|
|
||||||
|
You can override the default headers by defining `.httpHeaders` for the probe; for example
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
livenessProbe:
|
||||||
|
httpHeaders:
|
||||||
|
Accept: application/json
|
||||||
|
|
||||||
|
startupProbe:
|
||||||
|
httpHeaders:
|
||||||
|
User-Agent: MyUserAgent
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also remove these two headers by defining them with an empty value.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
livenessProbe:
|
||||||
|
httpHeaders:
|
||||||
|
Accept: ""
|
||||||
|
|
||||||
|
startupProbe:
|
||||||
|
httpHeaders:
|
||||||
|
User-Agent: ""
|
||||||
|
```
|
||||||
|
|
||||||
|
### TCP probes
|
||||||
|
|
||||||
For a TCP probe, the kubelet makes the probe connection at the node, not in the pod, which
|
For a TCP probe, the kubelet makes the probe connection at the node, not in the pod, which
|
||||||
means that you can not use a service name in the `host` parameter since the kubelet is unable
|
means that you can not use a service name in the `host` parameter since the kubelet is unable
|
||||||
to resolve it.
|
to resolve it.
|
||||||
|
|||||||
Reference in New Issue
Block a user