当前位置:网站首页>Probe of kubernetes
Probe of kubernetes
2022-07-26 16:28:00 【keyson R】
kubernetes Probe of
List of articles
Three probe types
- HTTP GET Probe to container IP Address execution HTTP GET request . If the detector receives a response , And the response status code does not represent an error ( let me put it another way , If HTTP Response status code is 2xx or 3xx), It is considered that the detection is successful . If the server returns an error response status code or does not respond at all , Then detection is considered a failure , The container will restart .
- TCP The socket probe attempts to establish with the port specified by the window TCP Connect . If the connection is successfully established , Then the detection is successful . otherwise , Container restart .
- Exec The probe executes arbitrary commands inside the container , And check the exit status code of the command . If the status code is 0, Then the detection is successful . All other status codes are considered to have failed .
Survival probe
Kubernetes It can be done through the survival probe (liveness probe) Check if the container is still running . It can be for pod Each container in the is assigned a survival probe .
If the probe fails ,Kubernetes The probe will be executed periodically and the container will be restarted .
Additional information about the survival probe :Liveness: http-get http://:8080/ delay=0s timeout=1s period=10s #success=1 #failure=3
Information interpretation :
- delay: Delay ,delay=0s Part shows that the detection starts immediately after the container is started .
- timeout:timeout=1s, The container must be in 1 Respond in seconds , Otherwise, the detection will be recorded as a failure .
- period:period=10s, Every time 10 Detect the container once a second .
- failure:failure=3, Restart the container after detecting three consecutive failures .
These additional parameters can be customized when defining the probe . for example , To set the initial delay , namely initialDelaySeconds. If the initial delay is not set , The probe will begin to detect the container immediately upon startup , This usually leads to probe failure , Because the application is not ready to start receiving requests . If the number of failures exceeds the threshold , Before the application can respond to the request correctly , The container will restart . There is a scene that you will often encounter : The container is restarting , But use kubectl describe You will see the container with the exit code 137 or 143 end , And see pod Was forced to terminate , Will also be in pod The list of events will show the container cause liveness Detection fails and terminates . In this case, it is mostly because the initial delay is not set .
Be sure to set an initial delay to indicate the start time of the application .
Ready probe
Ready probe (readiness probe) Will call... On a regular basis , And identify specific pod Whether to receive client requests . When the container's readiness probe returns success , Indicates that the container is ready to receive the request . Obviously, this is something unique to each container ,Kubernetes You can only check whether the application running in the container responds to a simple GET/ request , Or it can respond to a specific URL route , The URL Causes the application to perform a series of checks to determine whether it is ready . therefore , This exact determination of readiness is the responsibility of the application developer .
Why do I need a ready probe ?
If not, add the ready probe to pod in , They become service endpoints almost immediately . If the service starts but is not ready to receive incoming connections , The client request will be forwarded to the pod. Then the client will see “ Connection rejected ” Type of mistake .
Additional information about ready probes :Readiness: exec [ls /var/ready] delay=0s timeout=1s period=10s #success=1 #failure=3
Command interpretation : The ready probe will be executed in the container on a regular basis ls /var/ready command . If the file exists , be ls Command return exit code 0, Otherwise return to non 0 Your exit code . If the file exists , Then the ready probe will succeed , Otherwise it will fail .
The information interpretation in this is the same as that of the survival probe .
The ready probe ensures that the client only works with normal pod Interaction , And never know there's a problem with the system .
The difference between survival and ready probes
Unlike survival probes , If the container fails the readiness check , Will not be terminated or restarted . This is an important difference between the two probes .
Survival probes maintain by killing abnormal containers and replacing them with new normal containers pod Normal work , And the ready probe ensures that only the benefits of preparation are desired pod To receive a request . This is most necessary when the container starts .
Reference books :《Kubernetes in action》
边栏推荐
- [BJDCTF2020]Easy MD5
- Internet Protocol
- 量化交易之数字货币篇 - 通过时间戳与方向来合并逐笔成交数据(大单合并)
- TDengine 落地协鑫能科,数百亿数据压缩至 600GB
- Tao and art of R & D Efficiency - Tao chapter
- Linux Installation mysql8.0.29 detailed tutorial
- [e-mr] error recovery record of namenode
- Activity之onCreate、onRestoreInstanceState恢复数据的区别
- Re7: reading papers fla/mlac learning to predict charges for critical cases with legal basis
- Draw a beautiful outline of the middle school playground and generate longitude and latitude data
猜你喜欢

FTP protocol
![[arm learning (9) ARM compiler understanding learning (armcc/armclang)]](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[arm learning (9) ARM compiler understanding learning (armcc/armclang)]

Comprehensive design of an oppe homepage -- Design of navigation bar

NUC 11构建 ESXi 7.0.3f安装网卡驱动-V2(2022年7月升级版)

2022牛客暑期多校训练营1(ACDGIJ)

Re9:读论文 DEAL Inductive Link Prediction for Nodes Having Only Attribute Information

FTP协议

2022年全国最新消防设施操作员(高级消防设施操作员)考试试题及答案

Vscode batch delete

Re7: reading papers fla/mlac learning to predict charges for critical cases with legal basis
随机推荐
阿里云DMS MySQL云数据库建表报错,求解!!
Happy 10th birthday, clojure
C语言重点知识总结
“核弹级” Log4j 漏洞仍普遍存在,并造成持续影响
物联网工业级串口转WiFi转网口转以太网模块的选型
Clojure 运行原理之字节码生成篇
DTS搭载全新自研内核,突破两地三中心架构的关键技术|腾讯云数据库
Final consistency distributed transaction TCC
TKE集群节点max-pod是如何配置的
First knowledge of OpenGL (3) fragment shader
Sql语句——单行注释与多行注释
最终一致性性分布式事务 TCC
SQL statement -- single line comment and multi line comment
可信隐私计算框架“隐语”开源专家观点集锦
2022年全国最新消防设施操作员(高级消防设施操作员)考试试题及答案
Pat grade a 1050 string subtraction
Clojure Web Development -- ring user guide
A firefox/chrome plug-in that visualizes browser history
结构体和类使用的区别
C # set different text watermarks for each page of word