Skip to content

pod hpa would create extra pods during deployment rolling update when there is no load at all during the rolling upgrade #72775

@zq-david-wang

Description

@zq-david-wang

What happened:
I have deployment with following upgrade strategy

strategy:
  rollingUpdate:
    maxSurge: 1
    maxUnavailable: 0
  type: RollingUpdate

and hpa:

spec:
maxReplicas: 3
minReplicas: 1
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: xxxx
targetCPUUtilizationPercentage: 80

When sending patch command to update container image, (current replicas is 1), following happended

  1. new pod created and getting ready
  2. after the new pod ready, the old pod is terminating.
  3. hpa make a judgement call to set desired replica to 2
  4. after a while, hpa readjust to desired replica back to 1

What you expected to happen:

  1. new pod created and getting ready
  2. after the new pod ready, the old pod is terminating.

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

  1. create a deployment with replica set to 1, maxSurge 1, maxUnavailable: 0
  2. create a hpa targeting the deployment with replica 1 from 3, 80% cpu target
  3. change container image via kubectl edit or other approach
  4. keep checking pod count changes

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version):
  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/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.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.sig/autoscalingCategorizes an issue or PR as relevant to SIG Autoscaling.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions