1 - Harness Kubernetes Delegate

Updated 2 weeks ago by Michael Cretzman

The Harness Kubernetes Delegate runs in your target deployment cluster and executes all deployment steps, such the artifact collection and kubectl commands. The Delegate makes outbound connections to the Harness Manager only.

You can install and run the Harness Kubernetes Delegate in any Kubernetes environment, but the permissions needed for connecting Harness to that environment will be different for each environment.

The simplest method is to install the Harness Delegate in your Kubernetes cluster and then set up the Harness Cloud Provider to use the same credentials as the Delegate.

For information on how to install the Delegate in a Kubernetes cluster, see Kubernetes Cluster. For an example installation of the Delegate in a Kubernetes cluster in a Cloud Platform, see Installation Example: Google Cloud Platform.

Here is a quick summary of the steps for installing the Harness Delegate in your Kubernetes cluster:

  1. In Harness, click Setup, and then click Harness Delegates.
  2. Click Download Delegate and then click Kubernetes YAML.

  3. In the Delegate Setup dialog, enter a name for the Delegate, such as doc-example, and click SUBMIT. the YAML file is downloaded to your machine.

  4. Install the Delegate in your cluster. You can copy the YAML file to your cluster any way you choose, but the following steps describe a common method.
    1. In a Terminal, connect to the Kubernetes cluster, and then use the same terminal to navigate to the folder where you downloaded the Harness Delegate YAML file. For example, cd ~/Downloads.
    2. Extract the YAML file: tar -zxvf harness-delegate-kubernetes.tar.gz.
    3. Navigate to the harness-delegate folder that was created:
      cd harness-delegate-kubernetes
    4. Paste the following installation command into the Terminal and press enter:
      kubectl apply -f harness-delegate.yaml
      You will see the following output (this Delegate is named doc-example):

    namespace/harness-delegate created

    clusterrolebinding.rbac.authorization.doc-example/harness-delegate-cluster-admin created

    statefulset.apps/doc-example-lnfzrf created
    1. Run this command to verify that the Delegate pod was created:
      kubectl get pods -n harness-delegate
      You will see output with the status Pending. The Pending status simply means that the cluster is still loading the pod.
      Wait a few moments for the cluster to finish loading the pod and for the Delegate to connect to Harness Manager.
      In Harness Manager, in the Harness Delegates page, the new Delegate will appear. You can refresh the page if you like.

Note the Delegate name. You will use this name when you set up the Kubernetes Cluster Cloud Provider in Connectors and Providers Setup. the name is used to assign this Delegate to the all operations made using the Kubernetes Cluster Cloud Provider.

You might also want to use Delegate Profiles and Delegate Scope to further Delegate configuration. See Delegate Installation and Management.

Helm Client Only Mode: When you use a remote Helm chart in your Harness Service, you do not need to have Tiller installed on the Harness Delegate because Harness interacts directly with the Kubernetes API server to install, upgrade, query, and remove Kubernetes resources. The Helm client is used to fetch charts from the repository and render a template. Consequently, when you install Helm on the Harness Delegate pod you can use the client-only option, as described in Common Delegate Profile Scripts.

How did we do?