6

I have a pod with the following config:

apiVersion: v1
kind: Pod
metadata:
  labels:
    name: demo
  name: demo
spec:
  containers:
    - name: demo
      image: ubuntu:14.04
      command:
        - sleep
        - "3600"

When I try to stop it, the SIGTERM is ignored by the sleep command, and it takes 30 seconds (the full default grace period) to stop. I can also get on the pod and send the signal to the process (pid 1) manually, and it does not kill the pod. How can I get sleep to die when a signal is sent to it?

Charles L.
  • 5,795
  • 10
  • 40
  • 60

1 Answers1

6

Bash ignores SIGTERM when there are no traps. You can trap SIGTERM to force an exit. For example, trap 'exit 255' SIGTERM; sleep 3600

Yu-Ju Hong
  • 6,511
  • 1
  • 19
  • 24
  • I tried using this + http://stackoverflow.com/questions/33887194/how-to-set-multiple-commands-in-one-yaml-file-with-kubernetes and it still hangs :/ – Charles L. Dec 15 '15 at 00:10