How to terminate a pod when a specific event occurs

0 votes
In Kubernetes, I have a pod which is running 2 containers. When one container stops, another container is still running, On this event i want to terminate the pod. How can i do this? Somebody Please help!
Jul 19, 2019 in Kubernetes by Namik
• 1,230 points
1,180 views

1 answer to this question.

0 votes
  • You need to add a liveness and readiness probe to query each container,  if the probe fails, the entire pod will be restarted .

  • Add liveness object that calls any API that returns 200 to you from another container and both liveness and readiness probes run in infinite loops.

  • For example, If X depended to Y So add liveness  in X that check the health of Y.

  • Both readiness/liveness probes always have to run after the container has been started .

  • kubelet component performs the liveness/readiness checks and set initialDelaySeconds and it can be anything from a few seconds to a few minutes depending on app start time. 

  • Below is the configuration spec

livenessProbe spec:
livenessProbe:
httpGet:
path: /path/test/
port: 10000
initialDelaySeconds: 30
timeoutSeconds: 5
readinessProbe spec:
readinessProbe:
httpGet:
path: /path/test/
port: 10000
initialDelaySeconds: 30
timeoutSeconds: 5
answered Jul 19, 2019 by Sirajul
• 59,230 points

Related Questions In Kubernetes

0 votes
1 answer

how to debug a pending pod?

Pending pod cannot be scheduled onto a ...READ MORE

answered Jul 15, 2019 in Kubernetes by Sirajul
• 59,230 points
3,786 views
0 votes
1 answer

Is it possible to force the pod to run on a specific node?

By default, anti-affinity is not attempted by ...READ MORE

answered Jul 15, 2019 in Kubernetes by Sirajul
• 59,230 points
1,325 views
0 votes
1 answer

How do i tie a service to a pod or a set of pods?

By declaring pods with the label(s) and ...READ MORE

answered Jul 16, 2019 in Kubernetes by Sirajul
• 59,230 points
1,765 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
15,477 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,036 views
0 votes
2 answers

How do I force a pod to run on a specific node?

By default, anti-affinity is not attempted by Kubernetes as ...READ MORE

answered Aug 6, 2019 in Kubernetes by Sirajul
• 59,230 points
5,030 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP