From a9e6a0a938ef6eaa7bb6e27ed1f4051510c45197 Mon Sep 17 00:00:00 2001 From: Jason O'Donnell <2160810+jasonodonnell@users.noreply.github.com> Date: Wed, 6 Nov 2019 11:06:57 -0500 Subject: [PATCH] Add preStop lifecycle hook (#105) * Add preStop lifecycle hook * Fix typo in comment --- templates/server-statefulset.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/templates/server-statefulset.yaml b/templates/server-statefulset.yaml index e13d680..fcbae55 100644 --- a/templates/server-statefulset.yaml +++ b/templates/server-statefulset.yaml @@ -102,6 +102,14 @@ spec: periodSeconds: 3 successThreshold: 1 timeoutSeconds: 5 + lifecycle: + # Vault container doesn't receive SIGTERM from Kubernetes + # and after the grace period ends, Kube sends SIGKILL. This + # causes issues with graceful shutdowns such as deregistering itself + # from Consul (zombie services). + preStop: + exec: + command: ["/bin/sh","-c","kill -SIGTERM $(pidof vault)"] {{- if .Values.global.imagePullSecrets }} imagePullSecrets: {{- toYaml .Values.global.imagePullSecrets | nindent 8 }}