Ephemeral delegate mode
Run containerized step group steps in a short-lived delegate container, in the same Kubernetes cluster as the delegate or in a different one
Ephemeral delegate mode allows a Harness Delegate to run containerized step group steps in a short-lived delegate container that Harness adds to the step group pod. The pod can run in the same Kubernetes cluster as the delegate or in a different cluster, without installing a delegate there. Use it to run steps such as Git Clone and Run in a separate cluster, while keeping a single delegate to orchestrate them.
A standard delegate runs its work in the cluster where you install it, so running steps elsewhere means installing and maintaining another delegate there. In ephemeral delegate mode, the delegate that you select still orchestrates the step group. Harness adds a short-lived delegate container to the step group pod, which runs the steps. The ephemeral delegate exists only for the step group pod, so when the pod runs in a different cluster, there is nothing to install, upgrade, or monitor in that cluster.
What you will learn from this topic
Understand the step group pod execution flow in ephemeral delegate mode.
How to enable ephemeral delegate mode and set the delegate image.
How to configure a step group to use ephemeral delegate mode in the same cluster as the delegate or in another cluster.
How to read the Initialize logs and troubleshoot common issues.
Before you begin
Containerized step groups: Go to Containerize step groups to learn how to configure a step group that uses Kubernetes infrastructure.
Delegate: Delegate 1.x version 26.10.90103 or later, or Runner (task runner) version 3.8.0 or later. For more information, see Delegate overview.
Target cluster: The Kubernetes cluster where the step group pod runs, which can be the cluster where the delegate runs or a different one. You need a namespace in that cluster and a Harness Kubernetes Cluster connector that can reach it.
Network access: The target cluster must be able to reach the Harness control plane and pull the delegate image from
us-docker.pkg.dev.Feature flags: Contact Harness Support to enable
PIPE_ENABLE_EPHEMERAL_DELEGATE_MODE,PL_USE_TASK_RUNNER,CDS_INIT_CONTAINER_V2_ASYNC_STEP, andCDS_CONTAINER_STEP_GROUP_STEPS_USE_RUNNER. Enabling the feature flag alone is not enough. You must also enable the account, organization, or project setting.Pipeline permissions: You need View, Create/Edit, and Execute on pipelines. For more information, see RBAC in Harness.
Execution flow
When ephemeral delegate mode is enabled, Harness changes how the step group pod is built. The flow has the following stages:
The delegate you select in the step group creates the step group pod in the namespace and cluster defined by the step group's Kubernetes infrastructure.
Harness adds an ephemeral delegate container to that pod, along with an init container, volumes, and a secret that holds the ephemeral delegate configuration.
The task runner in the ephemeral delegate container runs the steps in the step group, such as Git Clone and Run.
When the steps finish, the task runner reports completion.
Running the step group in a different cluster is optional. The delegate that you select can run in the target cluster or in a different cluster. Steps run in ephemeral delegate mode only when the setting and the four feature flags are enabled. When they are enabled, the steps that you can run in a containerized step group or a CI stage are expected to run in this mode.
The ephemeral delegate container adds its own CPU and memory overhead to the pod. The Initialize log lists the total resources for the pod, including this overhead.
Enable ephemeral delegate mode
To enable ephemeral delegate mode, enable the setting and then set the delegate image.
Enable the setting
You can enable the setting at the account, organization, or project scope. The setting is False by default. A project inherits the value from its organization or account unless you override it.
Perform the following steps to enable the setting:
Navigate to Settings -> Default Settings -> Pipeline at the account, organization, or project scope.
Find Enable Ephemeral Delegate Mode.
Select True.
Click Save.

Set the ephemeral delegate image
Delegate 1.x requires the HARNESS_EPHEMERAL_DELEGATE_IMAGE environment variable. There is no default value, so set it as an environment variable in the delegate Helm values or manifest YAML to the image that Harness adds to the step group pod. If you use the Runner, the variable is optional because the Runner discovers the image automatically.
The following example sets the variable:
The following table describes the variable and the parts of its value:
HARNESS_EPHEMERAL_DELEGATE_IMAGE
Environment variable that you set on the Harness Delegate (Delegate 1.x) that orchestrates the step group. Its value is the image that Harness uses for the ephemeral delegate container in the step group pod. Required for Delegate 1.x and optional for the Runner.
us-docker.pkg.dev/gar-prod-setup/harness-public/harness/delegate
Repository path of the Harness delegate image in the public Harness Google Artifact Registry.
3.9.0
Image tag. The example uses 3.9.0. Harness does not set a default tag.
The cluster that runs the step group pod must be able to pull this image. In the Initialize log, the pulled image appears in the container events for the step group pod.
Configure a step group
Ephemeral delegate mode uses the same step group configuration as other containerized step groups. To run the step group in the same cluster as the delegate, select the connector and namespace for that cluster. To run it in a different cluster, select the connector and namespace for the other cluster. In the step group, enable container-based execution and configure the following settings:
Infrastructure: Select Kubernetes.
Kubernetes cluster: Select the Kubernetes Cluster connector for the target cluster.
Namespace: Enter the namespace in the target cluster where Harness creates the pod.
Delegate selector: Select the delegate that orchestrates the step group.
The following pipeline runs a Git Clone step and a Run step in the target cluster:
In this example:
stepGroupInfra.spec.connectorRefandnamespaceidentify the target cluster and namespace where the step group pod runs.delegateSelectorsselects the delegate that orchestrates the step group.The stage environment and infrastructure definition are independent of where the step group runs.
Verify the execution
When the pipeline runs, the Initialize step of the step group shows how Harness builds the pod. A successful run includes log entries similar to the following:
The injected ephemeral delegate topology line confirms that ephemeral delegate mode is active for the step group.
Troubleshooting
The following issues can appear when you run a step group in ephemeral delegate mode.
Next steps
Containerize step groups: Configure Kubernetes, VM, and Amazon ECS infrastructure for step groups.
Git Clone step: Clone a repository in a containerized step group.
Run step: Run scripts in a containerized step group.
Last updated
Was this helpful?