I try to restart the pod when an endpoint returns an HTTP 500 on the /health end . . .

Shiv:
I try to restart the pod when an endpoint returns an HTTP 500 on the /health endpoint. The service, probe-pod, should never send traffic to the pod while it is failing.
• The application needs to has an endpoint /start, which will indicate if it can accept traffic by returning an HTTP 200. If the endpoint returns an HTTP 500, the application has not finished initialization
• The application needs to have another endpoint /health that will indicate if the application is still working as expected by returning an HTTP 200. If the endpoint returns an HTTP 500 the application is no longer responsive.
• The probes should use port 8080

apiVersion: v1
kind: Pod
metadata:
 name: probe-pod
spec:
 containers:
   - image: nginx
     name: probe-pod
     args:
     - /started
     ports:
       - containerPort: 3000
         protocol: TCP
     livenessProbe:
       httpGet:
         path: /healthz
         port: 8080
       initialDelaySeconds: 2
     readinessProbe:
       httpGet:
         path: /started
         port: 8080
       timeoutSeconds: 2

Shiv:
Does this manifest correct ?

Shiv:
Do we need to give response code ?

Yogesh Yadav:
Container is exposed on port 3000 and probes are using different port.
Either expose another 8080 as a container port

1 Like