kubernetes: kubelet does not honor shortened grace period on already-deleting pod

What happened:

Delete a pod with a grace period of 120 seconds, then again with 60 seconds. It will still wait until the first 120 time elapses to delete the pod.

What you expected to happen:

For it to use the new grace period of 60 seconds

How to reproduce it (as minimally and precisely as possible):

ben@shadowfax:~$ kubectl get pod -o yaml | egrep -i 'term|del'
      blockOwnerDeletion: true
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
    terminationGracePeriodSeconds: 900

ben@shadowfax:~$ kubectl delete pod $(kubectl get pods | grep python | grep Running | cut -f1 -d' ') --grace-period=60
pod "python-645896764c-f5p9k" deleted

ben@shadowfax:~$ kubectl get pod -o yaml | egrep -i 'term|del'
      blockOwnerDeletion: true
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
    terminationGracePeriodSeconds: 900
    deletionGracePeriodSeconds: 60
    deletionTimestamp: "2019-10-02T16:27:50Z"
      blockOwnerDeletion: true
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
    terminationGracePeriodSeconds: 900

ben@shadowfax:~$ kubectl delete pod $(kubectl get pods | grep python | grep Running | cut -f1 -d' ') --grace-period=10
pod "python-645896764c-cfsjz" deleted

ben@shadowfax:~$ kubectl get pod -o yaml | egrep -i 'term|del'
      blockOwnerDeletion: true
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
    terminationGracePeriodSeconds: 900
    deletionGracePeriodSeconds: 10
    deletionTimestamp: "2019-10-02T16:27:15Z"
      blockOwnerDeletion: true
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
    terminationGracePeriodSeconds: 900
    deletionGracePeriodSeconds: 60
    deletionTimestamp: "2019-10-02T16:27:50Z"
      blockOwnerDeletion: true
      terminationMessagePath: /dev/termination-log
      terminationMessagePolicy: File
    terminationGracePeriodSeconds: 900

Environment:

  • Kubernetes version (use kubectl version): 1.14
  • Cloud provider or hardware configuration: Rancher/RKE/Hyperkube
  • OS (e.g: cat /etc/os-release): Ubuntu 18.04
  • Install tools: RKE/Rancher

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 18 (13 by maintainers)

Most upvoted comments

/assign

This is something I’m working on with #113606