Healthchecks in Kubernetes

Posted By : Nitin Kumar | 17-Dec-2020

Health checks in the Containerization world are a way to let your system know if an instance of your service is working or not working. Suppose an instance of your service is not working, then other services should not access it or send a request to it. Alternatively, requests should be sent to another instance of the app that is ready or retired at a later time. 

 

Once all the containers inside the pod start, Kubernetes start sending traffic by default. It also restarts containers in case they crash. By using health checks you can make your deployments more robust. 

 

Also Read: A Brief Overview of Important Kubernetes Concepts

 

Types of Health Checks in K8s:

Readiness:

Readiness probes are used when your Kubernetes cluster know when your particular pod is ready to serve traffic. Your Kubernetes cluster always makes sure that your readiness probe passes before your service sends traffic to the pod. And if your readiness probe fails then Kubernetes stop sending traffic to your pod.


Liveness:

Liveness probes are used when your Kubernetes cluster know when your service is working or not. If your service is working then Kubernetes leaves it as it is but if your service is down Kubernetes removes that pod and starts a new pod that replaces the old one.

      

 

Types of Probes:

There are 3 types of probes in Kubernetes have for test Readiness and Liveness.

1) HTTP
2) COMMAND
3) TCP
 

1) HTTP: HTTP probes are the most common type of liveness probe. Kubernetes pings a path which you defined in your deployment, and if it gets an http response between 200 to 300 so it will mark the pod healthy otherwise it will mark it unhealthy.

2) COMMAND: In Command probes, Kubernetes run a command inside your pod which you mention in your deployment. If your command runs successfully and returns exit code 0 then it will mark your pod healthy Otherwise it will mark your pod unhealthy.

3) TCP: TCP probe is used when your Kubernetes tries to establish a TCP connection on the specified port. If it can make a connection with a specified port then it will mark the pod healthy if not then it will mark it as unhealthy.

 

We are a seasoned DevOps service provider company that specializes in using Kubernetes K8s Engine to facilitate seamless deployment, scaling, scheduling, and operation of app containers in private, cloud, or hybrid environments. Our DevOps solutions and services enable enterprises to accelerate their software development lifecycle and and achieve efficiency with continuous deployment and continuous delivery. Our DevOps service providers use agile methodologies to enhance enterprise productivity and streamline IT operations.

About Author

Author Image
Nitin Kumar

He has knowledge of linux,docker,Kubernetes,Helm. Also has knowledge of Jenkins,Gitlab (CI/CD tools). Love to work in new technologies and implement it. Always try to do best in any work that is assigned.

Request for Proposal

Name is required

Comment is required

Sending message..