kubernetes pod with sleep command hangs

12/14/2015

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.
kubernetes

1 Answer

12/14/2015

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
Source: StackOverflow