-
Notifications
You must be signed in to change notification settings - Fork 19
Observability
Yasser Sinjab edited this page Apr 8, 2019
·
3 revisions
Create a busybox pod that 'echo Hello World!'. Show the logs of the pod:
kubectl run busybox --image=busybox --restart=Never -- /bin/sh -c 'echo Hello World!'
kubectl logs busybox
Create nginx pod and add HTTP GET liveness probe that hit '/' after 10 seconds of initializing the pod
kubectl explain pod.spec.containers.livenessProbe
kubectl explain pod.spec.containers.livenessProbe.httpGet
kubectl run nginx --image=nginx --restart=Never -o yaml --dry-run > pod.yaml
# Edit pod.yaml and add liveness probe
livenessProbe:
initialDelaySeconds: 10
httpGet:
path: /
port: 80
Unlike liveness probes, if a container fails the readiness check, it won’t be killed or restarted. It is a way to tell kubernetes that I'm the container not yet "ready" receive requests.
kubectl explain pod.spec.containers.readinessProbe
kubectl explain pod.spec.containers.readinessProbe.exec
kubectl run nginx --image=nginx --restart=Never -o yaml --dry-run > pod.yaml
# Edit pod.yaml and add liveness probe
readinessProbe:
exec:
command:
- cat
- /etc/passwd
kubectl describe po nginx | grep Read
Change the command in the previous pod to not existent file and describe the pod. Check the events and logs
kubectl logs nginx
kubectl describe po nginx
kubectl describe po nginx | grep Read
# Ready: False and ContainersReady: False