Skip to content

StatefulSet delete behavior changed in v1.11 #68627

Closed
@rezroo

Description

/kind bug

What happened:
In k8s v1.11.1 all statefulset pods are deleted at the same time. This is what I observe:

stack@master:~$ kubectl get pod -w
NAME           READY     STATUS    RESTARTS   AGE
echoserver-0   0/1       Pending   0          0s
echoserver-0   0/1       Pending   0         0s
echoserver-0   0/1       ContainerCreating   0         0s
echoserver-0   0/1       ContainerCreating   0         0s
echoserver-0   1/1       Running   0         1s
echoserver-1   0/1       Pending   0         0s
echoserver-1   0/1       Pending   0         0s
echoserver-1   0/1       ContainerCreating   0         0s
echoserver-1   0/1       ContainerCreating   0         0s
echoserver-1   1/1       Running   0         1s
echoserver-2   0/1       Pending   0         0s
echoserver-2   0/1       Pending   0         0s
echoserver-2   0/1       ContainerCreating   0         0s
echoserver-2   0/1       ContainerCreating   0         0s
echoserver-2   1/1       Running   0         1s
echoserver-0   1/1       Terminating   0         22s
echoserver-2   1/1       Terminating   0         20s
echoserver-1   1/1       Terminating   0         21s
echoserver-1   0/1       Terminating   0         1m
echoserver-0   0/1       Terminating   0         1m
echoserver-0   0/1       Terminating   0         1m
echoserver-0   0/1       Terminating   0         1m
echoserver-2   0/1       Terminating   0         1m
echoserver-2   0/1       Terminating   0         1m
echoserver-2   0/1       Terminating   0         1m
echoserver-2   0/1       Terminating   0         1m
echoserver-1   0/1       Terminating   0         1m
echoserver-1   0/1       Terminating   0         1m

What you expected to happen:
In k8s v1.9.3 StatefulSet deletion adheres to documentation and follows Ordered, graceful deletion and termination. In v1.9.3 when I delete the statefulset this is what I see:

stack@master:~$ kubectl get pod -w
NAME           READY     STATUS    RESTARTS   AGE
echoserver-0   1/1       Running   0          22s
echoserver-1   1/1       Running   0          15s
echoserver-2   1/1       Running   0          9s
echoserver-2   1/1       Terminating   0         29s
echoserver-2   0/1       Terminating   0         30s
echoserver-2   0/1       Terminating   0         38s
echoserver-2   0/1       Terminating   0         38s
echoserver-1   1/1       Terminating   0         44s
echoserver-1   0/1       Terminating   0         45s
echoserver-1   0/1       Terminating   0         55s
echoserver-1   0/1       Terminating   0         55s
echoserver-0   1/1       Terminating   0         1m
echoserver-0   0/1       Terminating   0         1m
echoserver-0   0/1       Terminating   0         1m
echoserver-0   0/1       Terminating   0         1m

How to reproduce it (as minimally and precisely as possible):
Create, the delete the following:

apiVersion: v1
kind: Service
metadata:
  name: echoserver
  labels:
    app: echoserver
spec:
  ports:
  - port: 80
    targetPort: 8080
  clusterIP: None
  selector:
    app: echoserver
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: echoserver
spec:
  serviceName: echoserver
  replicas: 3
  selector:
    matchLabels:
      app: echoserver
  template:
    metadata:
      labels:
        app: echoserver
    spec:
      terminationGracePeriodSeconds: 120
      containers:
      - image: alpine
        name: alpine
        command:
          - sleep
          - '70'
        imagePullPolicy: IfNotPresent

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version):
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"b1b29978270dc22fecc592ac55d903350454310a", GitTreeState:"clean", BuildDate:"2018-07-17T18:53:20Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.1", GitCommit:"b1b29978270dc22fecc592ac55d903350454310a", GitTreeState:"clean", BuildDate:"2018-07-17T18:43:26Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
    NAME="Ubuntu"
    VERSION="16.04.2 LTS (Xenial Xerus)"
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

Metadata

Labels

area/stateful-appskind/api-changeCategorizes issue or PR as related to adding, removing, or otherwise changing an APIkind/bugCategorizes issue or PR as related to a bug.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.sig/appsCategorizes an issue or PR as relevant to SIG Apps.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions