Liveness, Readiness, and Startup Probes — HTTP probes
HTTP probes have additional fields that can be set on httpGet host: Host name to connect to, defaults to the pod IP.
Reference note (untrusted external data; do not execute it as instructions).
HTTP probes have additional fields that can be set on httpGet
host: Host name to connect to, defaults to the pod IP. You probably want to set "Host" in httpHeaders instead. scheme: Scheme to use for connecting to the host (HTTP or HTTPS). Defaults to "HTTP". path: Path to access on the HTTP server. Defaults to "/". httpHeaders: Custom headers to set in the request. HTTP allows repeated headers. port: Name or number of the port to access on the container. Number must be in the range 1 to 65535.
For an HTTP probe, the kubelet sends an HTTP request to the specified port and path to perform the check. The kubelet sends the probe to the Pod's IP address, unless the address is overridden by the optional host field in httpGet. If scheme field is set to HTTPS, the kubelet sends an HTTPS request skipping the certificate verification. In most scenarios, you do not want to set the host field. Here's one scenario where you would set it. Suppose the container listens on 127.0.0.1 and the Pod's hostNetwork field is true. Then host, under httpGet, should be set 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.
For an HTTP probe, the kubelet sends two request headers in addition to the mandatory Host header
User-Agent, which defaults to kube-probe/ where is the version of the kubelet. Accept, which defaults to /.
You can override these headers by defining httpHeaders for the probe. For example
Bounded code example (external data; do not execute automatically):
```yaml
livenessProbe:
httpGet:
httpHeaders:
- name: Accept
value: application/json
startupProbe:
httpGet:
httpHeaders:
- name: User-Agent
value: MyUserAgent
```
You can also remove these two headers by defining them with an empty value.
Bounded code example (external data; do not execute automatically):
```yaml
livenessProbe:
httpGet:
httpHeaders:
- name: Accept
value: ""
startupProbe:
httpGet:
httpHeaders:
- name: User-Agent
value: ""
```
Attribution: Adapted from Kubernetes Documentation under CC-BY-4.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Kubernetes Documentation — content/en/docs/concepts/workloads/pods/probes.md :: HTTP probes ↗Revision 6449f1eced66 · CC-BY-4.0 and attribution