Skip to main content

Kubernetes Blue Green Stage Scale Down

Last updated on

The Kubernetes Blue Green Stage Scale Down step removes the old pod set after a successful blue-green swap. Add it after the Swap Services Selectors step when you want to free cluster resources once you are confident the new version is stable.


Before you begin

Before you configure the step, make sure you have the following in place:

  • A Kubernetes service: Go to Kubernetes services to set up service manifests and artifact source.
  • A Kubernetes infrastructure: Go to Kubernetes infrastructure to connect a cluster and namespace.
  • A Harness delegate in target cluster: The delegate runs deployment steps in the cluster.
  • Runtime configuration: Every Kubernetes stage requires a runtime block specifying connector and namespace. Go to Kubernetes runtime configuration to understand the required fields.

Configure the step

The following parameters are available on the Kubernetes Blue Green Stage Scale Down step.

ParameterDescriptionRequired
NameDisplay name for this step in the stage canvas. Default: Kubernetes Blue Green Stage Scale Down.Required
Kubeconfig PathPath to the kubeconfig file. Default: ${{infra.kube_config_path}}.Optional
NamespaceTarget namespace. Default: ${{infra.namespace}}.Optional
Release NameName used to look up the release history for the old pod set. Default: ${{infra.releaseName}}.Optional
Log LevelVerbosity of step logs. Default: info.Optional
Release name must be unique per namespace

When deploying multiple services to the same namespace using blue-green, each service must have a unique release name. If multiple services share the same release name, the Scale Down step may incorrectly identify which deployment to scale down.


How the step works

The step removes the following resources for the old (inactive) pod set:

  • HorizontalPodAutoscaler and PodDisruptionBudget resources
  • Deployments, DeploymentConfigs, and StatefulSets
  • DaemonSets (scaled to zero replicas)
Resources are deleted, not scaled to zero

The Scale Down step deletes workload resources rather than setting replicas to zero. This prevents HPA from overriding a zero-replica state on subsequent deployments. HPA and PDB resources deleted during Scale Down are not recreated during rollback; they require redeployment to restore.


Advanced settings

  • Timeout duration: Maximum time the step can run before Harness terminates it.
  • On failure: Define what happens if the step fails, such as retry, mark as success, or abort.
  • Strategy: Configure a looping strategy to run this step over a list of values.
  • Conditional execution: Run this step only when a specified condition is true.

Next steps