CKAD 2 | Multicontainer Podsο
Loggingο
Check pod logs
kubectl logs podName
Check container logs in a pod
kubectl logs podName containerName
Monitoringο
Check node resource
kubectl top nodes
Check pod resource
kubectl top pods
Probesο
Readiness Probe
By leveraging readiness probes, Kubernetes can ensure that only healthy and fully operational containers receive traffic from services or other pods, preventing requests from being sent to containers that are still starting up or experiencing issues. Hereβs a http readiness probe example,
spec -> containers ->
- readinessProbe:
httpGet:
path: /path
port: portNum
periodSeconds: periodValue
initialDelaySeconds: delayValue
Liveness Probe
The liveness probe focuses on the ongoing health of a container, automatically restarting it if needed. Hereβs a http liveness probe example,
spec -> containers ->
- livenessProbe:
httpGet:
path: /path
port: portNum
periodSeconds: periodValue
initialDelaySeconds: delayValue
initContainersο
Init containers are specialized containers that run before app containers in a Pod.
Configuration
spec -> initContainers ->
- name: initContainerName
image: initContainerImage
# The rest is similar to a normal container