Repository navigation
How can you specify a preStop handler for KubernetesPodOperator? #13938
Unanswered
saikarthikp9
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I am trying to run a shell script using the preStop handler when the pod (A) is killed. I would also need to specify the terminationGracePeriodSeconds, although the default of 30 seconds should work in this case.
Purpose:
I want to delete some other running pods. These pods were created by pod A. I will be using helm uninstall to terminate these pods.
References:
Intro to handlers: https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/
Example usage of preStop handler:
apiVersion: apps/v1 kind: Deployment metadata: creationTimestamp: null labels: run: busybox name: busybox spec: replicas: 1 selector: matchLabels: run: busybox strategy: {} template: metadata: creationTimestamp: null labels: run: busybox spec: containers: - image: temp-test:local name: busybox command: ["httpd"] args: ["-p", "8080", "-f", "-v"] ports: - containerPort: 8080 **lifecycle: preStop: exec: command: ["/bin/pre-stop.sh"]** resources: {}example above taken from: kubernetes/kubernetes#91326
All reactions