You can see the Pods' statuses by running kubectl get pods
.
You can see Pods' statuses by running kubectl describe pod podName
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.
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
:
initialDelaySeconds
: seconds to wait before start the testsperiodSeconds
: interval between each testfailureThreshold
: how many fails needed to set Ready
status to false
The liveness probe exist to tell kubernetes that a pod must be restarted (if the test fails).
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
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.
Once it's installed, you can use commands like this:
kubectl top node
kubectl top pod