Observability

Readiness and Liveness Probes

Pod Statuses

You can see the Pods' statuses by running kubectl get pods.

Pod Conditions

You can see Pods' statuses by running kubectl describe pod podName

Ready Conditions

kubectl get pods shows a READY column.

The number at the rightside is the amount of containers, and in the leftside is the amount of container that are ready. If both numbers are the equal, the Pod is ready to receive traffic.

Sometimes a container is running but the application is still not ready to receive traffic. That's where the readiness probe is useful.

Readiness Probe

With the Readiness Probe we can set a way for kubernetes to know if the pod is really ready to receive requests.

HTTP Test

readinessProbe:
  httpGet:
    path: /api/ready
    port: 8080

TCP Test

readinessProbe
  tcpSocket:
    port: 3306

Execute Command Test

readinessProbe:
  exec:
    command:
      - cat
      - /app/is_ready

Other options to be used in readinessProbe:

Liveness Probe

The liveness probe exist to tell kubernetes that a pod must be restarted (if the test fails).

Container Logging

You can see the logs in a pod with this command:

kubectl logs -f podName

But if you have multiple containers in a pod, you need to explicitly say the container's name:

kubectl logs -f podName containerName

Monitor and Debug Applications

Kubernetes doesn't have with a builtin monitoring system.

Here are some options:

NOTE: if you see mentions to the Heapster, be aware that it's now deprecated.

Metrics Server

Once it's installed, you can use commands like this:

kubectl top node
kubectl top pod