nginx image/healthz on port 80/ready on port 80nginx image/healthz on port 80/ready on port 80nginx-pod.yaml with a single container named nginx using the image nginx:latest. The container should expose port 80.Use apiVersion: v1 and kind: Pod. Define metadata.name as nginx-pod. Under spec.containers, add one container named nginx with image nginx:latest and expose port 80.
livenessProbe and a readinessProbe to the nginx container. Both probes should use httpGet on port 80. Set the livenessProbe path to /healthz and the readinessProbe path to /ready. Use default probe settings for initial delay and period.Under the container spec, add livenessProbe and readinessProbe sections. Use httpGet with path and port fields. Use paths /healthz and /ready respectively.
kubectl apply -f nginx-pod.yaml. Then use kubectl get pods nginx-pod -o jsonpath='{.status.containerStatuses[0].restartCount}' to check the container restart count. Write a command to get the restart count.Use kubectl apply -f nginx-pod.yaml to create the Pod. Then use kubectl get pods nginx-pod -o jsonpath='{.status.containerStatuses[0].restartCount}' to see how many times the container restarted.
livenessProbe and readinessProbe paths to / (root path). Apply the updated manifest with kubectl apply -f nginx-pod.yaml. Then print the restart count again using kubectl get pods nginx-pod -o jsonpath='{.status.containerStatuses[0].restartCount}'. Write the command to print the restart count.Change both probe paths to / which is a valid path for nginx. Apply the manifest again and check the restart count. It should not increase if probes succeed.
/health at port 8080?httpGet with path starting with a slash and port as a number./health and port 8080. livenessProbe:
exec:
command: ["curl", "/health"]
initialDelaySeconds: 5
periodSeconds: 10 uses exec with curl incorrectly. livenessProbe:
tcpSocket:
port: 8080
initialDelaySeconds: 5
periodSeconds: 10 uses tcpSocket which is different. livenessProbe:
httpGet:
path: health
port: 8080
initialDelaySeconds: 5
periodSeconds: 10 misses the leading slash in path.readinessProbe:
httpGet:
path: /ready
port: 80
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /live
port: 80
initialDelaySeconds: 5
periodSeconds: 10initialDelaySeconds: 5 and periodSeconds: 10. What is a likely cause and fix?initialDelaySeconds is too short, the probe runs before the app is ready, causing false failures.initialDelaySeconds gives the container time to start before probing, preventing unnecessary restarts.initialDelaySeconds to allow startup time. -> Option APass the test and this pattern moves unknown