Skip to content

kubelet does not honor shortened grace period on already-deleting pod #83916

@bentastic27

Description

@bentastic27

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

Metadata

Metadata

Labels

kind/bugCategorizes issue or PR as related to a bug.lifecycle/frozenIndicates that an issue or PR should not be auto-closed due to staleness.priority/backlogHigher priority than priority/awaiting-more-evidence.sig/nodeCategorizes an issue or PR as relevant to SIG Node.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

Status

Todo

Status

Triaged

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions