云容器引擎 CCE-存活探针(Liveness Probe):TCP Socket

时间:2024-08-29 19:04:24

TCP Socket

TCP Socket尝试与容器指定端口建立TCP连接,如果连接成功建立,说明容器是健康的,定义方法如下所示。

apiVersion: v1
kind: Pod
metadata:
  labels:
    test: liveness
  name: liveness-tcp
spec:
  containers:
  - name: liveness
    image: nginx:alpine
    livenessProbe:           # liveness probe
      tcpSocket:
        port: 80
  imagePullSecrets: 
  - name: default-secret
support.huaweicloud.com/basics-cce/kubernetes_0010.html