k8s health check

the default health check : pod will restart when encountering error

create Pod ,simulate failure by exit “1”
then pod has restarted 3 times

在这里插入图片描述

Liveness:

the process will create healthy file,delete it after 30 s .
livenessProbe probes whether the file is or not 10s after created,per 5s,
the pod will restart when probe fails for 3 times

在这里插入图片描述

Readness:

replace liveness with readness
在这里插入图片描述
Pod readiness:
1.not ready when created
2.in initialDelaySeconds ,ready
3.readness probes failure for 3 times,not ready

在这里插入图片描述

kubectl describe pod readiness :
the failure log for probe
在这里插入图片描述

comparison between liveness and readiness:

to judge the success of probe whether return value is 0 after process is started

they are independent:
1.liveness probe determines if the containers need to be restarted to achieve self-healting;
2.readiness probe determines if the containers are ready to serve

we can use Readiness to scale up pods:

if readinessProbe (such as probing httpget for ip:port/path to determine whether the pod is ready ,if ready the pods will be added to Service 's backend pool to serve the client request )

For multi-copy applications, when a Scale Up operation is performed, the new copy is added as a backend to the Service’s responsible balance, processing the client’s request along with the existing copy. Considering that application startup usually requires a preparation phase, such as loading cached data, connecting to a database, etc., it takes a while to get services from the container to the server. We can use the Readiness probe to determine if the container is ready to avoid sending the request to a backend that is not ready.

we can use Readiness to rolling upgrade :

If the Health Check is configured correctly, the new copy will only be added to the Service if it passes the Readiness probe; if it is not detected, the existing copy will not be replaced and the service will still be normal.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值