For the complete documentation index, see llms.txt. This page is also available as Markdown.

Add a Rancher cluster connector

Connect Harness to Kubernetes clusters managed by Rancher.

Use a Harness Rancher cluster connector to connect Harness to Kubernetes clusters managed by Rancher. Use the Rancher cluster connector to deploy to Rancher-managed on-prem Kubernetes clusters from Harness pipelines.


What you will learn from this topic


Before you begin

  • Rancher server URL: The URL of your Rancher server, for example https://rancher.mycompany.com. Go to Create an API key in the Rancher documentation. The Endpoint value shown when you create an API key is your Rancher server URL.

  • Rancher API bearer token: A Rancher API bearer token for a dedicated service account or user, stored as a Harness secret. Go to Create an API key in the Rancher documentation to generate one from Account & API Keys in the Rancher UI. Rancher displays the bearer token only once, so copy and store it immediately.

  • Target cluster and namespace names: The names of the Rancher-managed clusters and namespaces you want Harness to deploy to.

  • Harness Delegate: A running Harness Delegate that can reach your Rancher server. Go to Delegate installation overview to install one. The Rancher cluster connector always communicates with Rancher through a Harness Delegate.

If you do not administer the Rancher server yourself, request the following from your Rancher administrator:

  • The Rancher URL.

  • The target cluster names and namespace names.

  • A Rancher API bearer token for a dedicated service account or user.

  • Confirmation of whether the token is scoped to specific clusters.

Minimum permissions

The Rancher bearer token must allow the APIs Harness uses, including:

  • /v3/clusters

  • /v3/clusters/{clusterName}?action=generateKubeconfig

The underlying Rancher user typically needs one of the following:

  • Cluster Owner on the target cluster.

  • A Global Permission set that enables cluster administration.

Network requirements

  • Outbound HTTPS from the Harness Delegate to the Rancher endpoint.

  • If your Rancher server uses an internal certificate authority (CA), the delegate must trust the Rancher CA chain.


Create a Rancher cluster connector

Perform the following steps to create the Rancher cluster connector using the Harness Manager. The connector wizard has four steps: Overview, Details, Delegates Setup, and Connection Test.

  1. Open a Harness project, and select Connectors under Project Setup. You can also create connectors at the account or organization levels.

  2. Select New Connector, and then select Rancher Cluster under Cloud Providers.

Overview

Enter a Name for the connector. Description and Tags are optional. Harness automatically creates an Id (entity identifier) for the connector based on the Name. Select Continue to proceed to Details.

Overview step of the Rancher cluster connector wizard

Details

Select Specify rancher URL and credentials, and then select Continue after entering the following details:

  • Rancher URL: Enter your Rancher server URL, for example https://rancher.mycompany.com.

  • Authentication: Select Bearer Token.

  • Token: Select Create or Select a Secret to add your Rancher API bearer token.

Details step of the Rancher cluster connector wizard

Delegates Setup

Select one of the following options, and then select Save and Continue:

  • Use any available Delegate.

  • Only use Delegates with all of the following tags: Enter the tag of the delegate you installed.

Delegates Setup step of the Rancher cluster connector wizard

Connection Test

Harness validates the Rancher cluster connector authentication and permissions. Once verification succeeds, select Finish.

Connection Test step of the Rancher cluster connector wizard

The connector now appears in the Connectors list.


YAML example

The following YAML defines a Rancher cluster connector that authenticates using a bearer token.

Rancher cluster connector YAML

Next steps

Last updated

Was this helpful?