Kubernets There are three mechanisms for detecting containers
1, HTTP GET request to the HTTP GET probe performs IP address (and port you specify a path) of the container. If the detector response is received, and in response does not represent an error status code (in other words, if the HTTP response status code is 2XX or 3XX), it is considered a successful test. If the server returns an error response status code or no response, then the probe was considered a failure, the container will be restarted.
2, TCP socket and the container probe specified port attempts to establish a TCP connection. If the connection is successfully established, the probe was successful. Otherwise, the container is restarted.
3, EXEC probe that is doing business in a container intended order, and the exit status check command. If the status code is 0, the probe dnal.rn other status codes are considered to be a failure.
apiVersion: v1
kind: Pod
metadata:
name: kubia-liveness
namespace: test
spec:
containers:
- name: kubia
image: luksa/kubia-unhealthy
livenessProbe: #一个HTTP GET 存活探针
httpGet:
port: 8080 #探针连接的网络端口
path: / #HTTP请求的路径