In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the use of Kubernetes probe, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
Kubernetes provides a probe (Probe) to test the health of the container. In fact, we have to check not only the health of the container, but also the health of the applications arranged in the container.
There are two types of Probe:
LivenessProbe: survival probe. If the check fails, it will kill the container and restart the operation according to Pod's restartPolicy policy.
ReadinessProbe: ready probe, if the check fails, Kubernetes will remove Pod from the service endpoints.
Probe supports the following three inspection methods:
HttpGet: send a HTTP request and return the 200-400 range status code as successful.
Exec: the status code returned by the Shell command is 0 as successful.
TcpSocket: the initiating TCP Socket was established successfully.
Let's give the configuration of each inspection method:
Exec check
ApiVersion: v1kind: Podmetadata: labels: test: liveness name: liveness-execspec: containers:-name: liveness image: busybox args:-/ bin/sh-- c-touch / tmp/healthy; sleep 30; rm-rf / tmp/healthy Sleep 60000livenessProbe: # # livenessProbe check type exec: # # exec check method command:-cat-/ tmp/healthy initialDelaySeconds: 5 # # check 5 seconds after the container starts periodSeconds: 5 # # check every 5 seconds
HttpGet check
ApiVersion: v1kind: Podmetadata: labels: test: liveness name: liveness-httpspec: containers:-name: liveness image: k8s.gcr.io/liveness args:-/ server livenessProbe: # # livenessProbe httpGet: # # httpGet checking method path: / healthz port: 8080 httpHeaders:-name: Custom-Header value: Awesome initialDelaySeconds: 3 periodSeconds: 3
TcpSocket check
ApiVersion: v1kind: Podmetadata: name: goproxy labels: app: goproxyspec: containers:-name: goproxy image: k8s.gcr.io/goproxy:0.1 ports:-containerPort: 8080 readinessProbe: # # readinessProbe check type tcpSocket: # # tcpSocket check method port: 8080 initialDelaySeconds: 5 periodSeconds: 10 livenessProbe: # # livenessProbe check type tcpSocket: # # tcpSocket check method Port: 8080 initialDelaySeconds: 15 periodSeconds: 20 Thank you for reading this article carefully I hope the article "what is the use of Kubernetes probe" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 227
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.