Skip to main content

Kubernetes rollout restart

note
  1. This feature is currently behind the feature flag, CDS_K8S_ROLLOUT_STEP. Contact Harness support to enable it.
  2. This feature requires Harness Delegate version 832xx.

This topic describe how you can restart your deployed Kubernetes resources by using K8s Rollout step.

Harness follows standard Kubernetes behavior during rollout. See kubectl rollout.

When to use K8s Rollout step?

  • Configuration Changes: When there are changes in ConfigMaps, Secrets, or other configurations that your application depends on, and you need to apply these changes without changing the image.

  • Certificate Rotation: To apply new certificates.

  • Environment Variables Update: When there are updates to environment variables in the pod specifications.

  • General Pod Refresh: To refresh the state of pods without making changes to the container image.

K8s Rollout Step

This step provides various commands like Restart, Resume, Status, Undo, Pause and History on top of basic Kubernetes rollout command.

You can target a specific Resource, Manifest as well Release name.

Kubernetes Rollout YAML using supported Subcommands

In these example yaml we are using Manifest you can use Resource name as well as Release name

Kubernetes Rollout restart Yaml

Triggers a rolling restart of the pods managed by a deployment.

- step:
type: K8sRollout
name: K8sRollout_Restart_ManifestPath_RuntimInput
identifier: K8sRollout_Restart_ManifestPath_RuntimInput
spec:
command: restart
resources:
type: ManifestPath
spec:
manifestPaths: <+input>
timeout: 10m

Kubernetes Rollout Pause

Pauses the rollout of a deployment.

- step:
type: K8sRollout
name: K8sRollout_Pause_ManifestPath_fixedInput
identifier: K8sRollout_Pause_ManifestPath_fixedInput
spec:
command: pause
resources:
type: ManifestPath
spec:
manifestPaths:
- deployment.yaml

Kubernetes Rollout Status

Shows the status of the rollout.

- step:
type: K8sRollout
name: K8sRollout_Status_ManifestPath_fixedInput
identifier: K8sRollout_Status_ManifestPath_fixedInput
spec:
command: status
resources:
type: ManifestPath
spec:
manifestPaths:
- deployment.yaml

Kubernetes Rollout Resume

Resumes a paused rollout.

- step:
type: K8sRollout
name: K8sRollout_Resume_ManifestPath_fixedInput
identifier: K8sRollout_History_ManifestPath_fixedInput
spec:
command: Resume
resources:
type: ManifestPath
spec:
manifestPaths:
- deployment.yaml
timeout: 10m

Kubernetes Rollout History

Shows the rollout history for a deployment.

- step:
type: K8sRollout
name: K8sRollout_History_ManifestPath_fixedInput
identifier: K8sRollout_History_ManifestPath_fixedInput
spec:
command: history
resources:
type: ManifestPath
spec:
manifestPaths:
- deployment.yaml
timeout: 10m

Kubernetes Rollout Undo

Reverts the deployment to a previous revision.

- step:
type: K8sRollout
name: K8sRollout_Undo_ManifestPath_fixedInput
identifier: K8sRollout_History_ManifestPath_fixedInput
spec:
command: Undo
resources:
type: ManifestPath
spec:
manifestPaths:
- deployment.yaml
timeout: 10m

Video

Here's a video demo of how to add a K8s Rollout step:

See also