Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

160
Vistas
Can I terminate a process gracefully before the hard eviction with a prestop hook?

My Application stops gracefully when receiving a SIGTERM. graceful-stop operation is deleting a znode in the ZooKeeper.

But what I try is to automatically terminate a process gracefully before the Kubernetes evicts my pod.

I want to set prestop hook to "kill 1" to make a graceful-stop before the pod is evicted.

I'm not expecting prestop hook will work in all cases, but I think, this way I'll have some assurance.

I wonder if my idea is feasible.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Yes preStop is possible - and covers your use case. Here's the k8s docs example:

apiVersion: v1
kind: Pod
metadata:
  name: lifecycle-demo
spec:
  containers:
  - name: lifecycle-demo-container
    image: nginx
    lifecycle:
      postStart:
        exec:
          command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]
      preStop:
        exec:
          command: ["/bin/sh","-c","nginx -s quit; while killall -0 nginx; do sleep 1; done"]
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda