[Kubernetes] Pod Health

Kubernetes relies on Probes to determine the health of a Pod container. A Probe is a diagnostic performed periodically by the kubelet on a container.api

docside

 

There are two types of Probes:spa

1. Livenss Probe3d

Liveness probes can be used to determine if a Pod is healthy and running as expectedrest

2. Readiness Probecode

Readiness probes can be used to determine if a Pod should receive requestsorm

 

Failed Pod containers are recreated by default (restartPolicy defaults to Always).blog

 

What is the way to check Pod health?ci

ExecAction: Excutes an action inside the containerget

TSPSockerAction: TCP check against the container's IP address on specified port

HTTPGetAction: HTTP GET request against container

 

Probes can have the following results:

 - Success

 - Failure

 - Unknown

 

 

or

pods/probe/exec-liveness.yaml 

apiVersion: v1
kind: Pod
metadata:
  labels:
    test: liveness
  name: liveness-exec
spec:
  containers:
  - name: liveness
    image: k8s.gcr.io/busybox
    args:
    - /bin/sh
    - -c
    - touch /tmp/healthy; sleep 30; rm -rf /tmp/healthy; sleep 600
    livenessProbe:
      exec:
        command:
        - cat
        - /tmp/healthy
      initialDelaySeconds: 5
      periodSeconds: 5

 

--

相關文章
相關標籤/搜索