Getting Started with Kubernetes(Second Edition)
上QQ阅读APP看书,第一时间看更新

TCP checks

Kubernetes also supports health checks via simple TCP socket checks and also with custom command-line scripts. The following snippets are examples of what both use cases look like in the YAML file:

livenessProbe: 
exec:
command:
-/usr/bin/health/checkHttpServce.sh
initialDelaySeconds:90
timeoutSeconds: 1

Listing 2-9: Health check using command-line script

livenessProbe: 
tcpSocket:
port: 80
initialDelaySeconds: 15
timeoutSeconds: 1

Listing 2-10: Health check using simple TCP Socket connection