O'Reilly logo

Getting Started with Kubernetes by Jonathan Baier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Health checks

Kubernetes provides two layers of health checking. First, in the form of HTTP or TCP checks, K8s can attempt to connect to a particular endpoint and give a status of healthy on a successful connection. Second, application-specific health checks can be performed using command line scripts.

Let's take a look at a few health checks in action. First, we'll create a new controller with a health check:

apiVersion: v1 kind: ReplicationController metadata: name: node-js labels: name: node-js spec: replicas: 3 selector: name: node-js template: metadata: labels: name: node-js spec: containers: - name: node-js image: jonbaier/node-express-info:latest ports: - containerPort: 80 livenessProbe: # An HTTP health check httpGet: path: /status/ port: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required