Exercise
-
Create the specification of a Pod based on the stefanprodan/podinfo image
-
Add a liveness probe checking the /healthz on port 9898 every 10 seconds after an initial delay of 30 seconds
-
Add a readiness probe checking the /readyz on port 9898 every 5 seconds after an initial delay of 30 seconds
-
Delete the Pod
Documentation
Solution
- Create the specification of a Pod based on the stefanprodan/podinfo image
kubectl run podinfo --image=stefanprodan/podinfo --dry-run=client -o yaml > podinfo.yaml
- Add a liveness probe checking the /healthz on port 9898 every 10 seconds
apiVersion: v1
kind: Pod
metadata:
labels:
run: podinfo
name: podinfo
spec:
containers:
- image: stefanprodan/podinfo
name: podinfo
livenessProbe:
httpGet:
path: /healthz
port: 9898
periodSeconds: 10
initialDelaySeconds: 30
- Add a readiness probe checking the /readyz on port 9898 every 5 seconds
apiVersion: v1
kind: Pod
metadata:
labels:
run: podinfo
name: podinfo
spec:
containers:
- image: stefanprodan/podinfo
name: podinfo
livenessProbe:
httpGet:
path: /healthz
port: 9898
periodSeconds: 10
initialDelaySeconds: 30
readinessProbe:
httpGet:
path: /readyz
port: 9898
periodSeconds: 5
initialDelaySeconds: 30
- Delete the Pod
k delete po podinfo