Menu

US Region

Grandmetric LLC
Lewes DE 19958
16192 Coastal Hwy USA
EIN: 98-1615498
+1 302 691 94 10
info@grandmetric.com

EMEA Region

GRANDMETRIC Sp. z o.o.
ul. Metalowa 5, 60-118 Poznań, Poland
NIP 7792433527
+48 61 271 04 43
info@grandmetric.com

UK

Grandmetric LTD
Office 584b
182-184 High Street North
London
E6 2JA
+44 20 3321 5276
info@grandmetric.com

  • en
  • pl
  • Kubernetes Liveness Probes with examples

    Kubernetes Liveness Probes – review

    Date: 02.11.2020

    Category: DevOps


    Providing reliable, high-availability applications is combined with the need to automate the control of the application state. Kubernetes provides a set of tools to facilitate this task. This article will focus on the Liveness probe object, I will show the applications of each type – TCP Socket, Command Execution, HTTP Request.

    TCP Socket

    This kind of establishing a TCP connection to a pod (or pods) on the port specified in the configuration. This solution is especially useful for “non-HTTP” applications, for example Postfix mail server. Liveness probe tries to connect to pod, if no connection fails, pod (or pods) will reboot.

    Situation where everything is fine:

     

    Example situation where container port mismatch with the port define in Liveness probe configuration (like close port in real situation):

    Command Execution

    In this case, liveness probe will execute the command inside the container and check the returned status. The container is restarted when a status other than 0 is returned

    Situation where everything is fine:

    Example with problem:

    HTTP Request

    This case is very helpful when maintaining WEB applications. Liveness prob recurring polls the endpoint responsible for restoring the health of the application. Returning a status from the 4xx and 5xx family will qualify the pod (pods) for restart.

    Situation when health status endpoint return 2xx status code: 

     

    Situation when endpoint return status code 4xx or 5xx:

    Summary

    In this article, I would like to illustrate how individual Liveness probes work. Specific examples to use once with all side options are described in Design & Config.

    Author

    Wojciech Tokarski

    Software Engineer and Kubernetes Certified Professional

    Leave a Reply

    Your email address will not be published. Required fields are marked *


    5G Consulting Offer

     

    5G Standardization consulting | 5G Tender & Feasibility study analysis | 5G POC project management | Tailored 5G Trainings | 5G R&D
    Let's discuss your 5G challenges
    Grandmetric