首页 > Web开发 > 详细

[Kubernetes] Pod Health

时间:2019-11-01 00:00:22      阅读:114      评论:0      收藏:0      [点我收藏+]

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.

docs

 

There are two types of Probes:

1. Livenss Probe

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

2. Readiness Probe

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

 

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

 

What is the way to check Pod health?

ExecAction: Excutes an action inside the container

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

 

--

技术分享图片

 

[Kubernetes] Pod Health

原文:https://www.cnblogs.com/Answer1215/p/11774566.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!