Harness Argo CD GitOps Quickstart

Updated 2 weeks ago by Megha Mathur

Currently, this feature is behind the Feature Flag ARGO_PHASE1. Contact Harness Support to enable the feature.

This quickstart shows you how to connect Argo CD and Harness. 

Once Argo CD is connected to Harness, the Argo CD interface is exposed in the Harness Manager and you can create and manage your Argo CD Applications using Harness.

In this topic:

Objectives

In this quickstart you will learn how to create the Harness Argo CD Adapter and connect Argo CD to Harness. In this process you will:

  • Download and edit the Harness Argo CD Adapter Kubernetes manifest files.
  • Deploy the Harness Argo CD Adapter to the cluster running Argo CD.
  • Add the Harness Argo CD Adapter in Harness and connect Argo CD with Harness.

Visual Summary

Harness connects to Argo CD by using a Harness Adapter. The Adapter acts as a proxy server and enables Cross-Origin Resource Sharing (CORS). This allows Argo CD Server to be loaded in the Harness Manager. When using this Adapter, no additional configuration changes are required in your Argo CD instance.

The Argo CD Adapter only makes secure outbound connections to Harness. There are no inbound connections.

Once the Adapter is installed and connected to the Argo CD instance, the Argo CD interface can be exposed in Harness using the Adapter. Then you can use Argo CD from within Harness just like you would when logging into the Argo CD Server through a browser.

Before You Begin

Make sure you have the following:

  • Kubernetes Cluster with Argo CD installed: This cluster is where you will install the Harness Adapter.
  • Access to GitHub: This is needed to use the YAML files for the Harness Argo CD Adapter.

If you're new to Argo CD, see Argo CD Getting Started Guide.

Step 1: Install the Adapter in the Cluster

To install the Adapter, do the following:

Download the Harness Argo CD Adapter Kubernetes YAML file from GitHub or copy and paste it into a text editor.

This quickstart uses the argo-quickstart.yaml manifest (https://github.com/wings-software/harness-docs/blob/main/argoui-adapter/argo-quickstart.yaml).

There are other manifests in the repo for different use cases:

- adapter-trusted.yaml: When deploying the Adapter with a trusted CA certificate. See adapter-trusted.yaml.
- adapter-selfsigned.yaml: When deploying the Adapter with a self-signed certificate. See adapter-selfsigned.yaml.

You can see that the image for the Adapter is argocd-ui-proxy. When you deploy this manifest, Kubernetes pulls the image from a public repository on DockerHub.

Update the manifest for the URL of your Argo CD Server.

In the ConfigMap manifest, replace the <ArgoCdServerURL> with the Argo CD Server URL. The Argo CD Server URL is the URL Endpoint for the Argo CD Server. The same URL you would use to log into Argo CD Server in your browser.

kind: ConfigMap
metadata:
name: harness-argocd-adapter
namespace: argocd
data:
ARGO_CD_URL: <ArgoCdServerURL>
ALLOWED_ORIGINS: https://app.harness.io

For Harness On-Prem editions, the ALLOWED_ORIGINS setting should use the IP address or domain name you use to log into Harness On-Prem. Typically this is the IP address of the load balancer for Harness On-Prem or a DNS domain name that resolves to that IP address.

In the Service manifest, you can see loadBalancerSourceRanges with the Harness IP addresses:

loadBalancerSourceRanges:
- 34.82.155.149/32
- 34.83.51.28/32
- 35.230.70.231/32
- 35.236.117.224/32
- 35.236.112.238/32

You will need these IPs added to loadBalancerSourceRanges whenever you are using Argo CD with the SaaS version of Harness.

If you are using Harness On-Prem, you do not need loadBalancerSourceRanges. You can delete it from the file.

Once the file is updated, save it locally as argo-quickstart.yaml. Navigate to the folder where the file is saved. 

Log into the Kubernetes cluster where Argo CD is installed.

Apply the Kubernetes file:

kubectl apply -f argo-quickstart.yaml

The output will look like this:

configmap/harness-argocd-adapter created
service/harness-argocd-adapter created
deployment.apps/harness-argocd-adapter created

Now the Harness Argo CD Adapter is running. Next, you will use the Adapter URL in Harness to connect to Argo CD Server.

Step 2: Get the Adapter URL from the Cluster

Now that the Adapter is running, you can obtain its endpoint URL. You'll use this endpoint URL to add a new Adapter in the Harness Manager.

Here is an example using GKE.

Open the GKE cluster where you installed the Adapter.

Click Workloads, and then search Name:harness-argocd-adapter.

Click harness-argocd-adapter workload.

The workload can take some time to start. If you see the following error messages, simply wait a few minutes.

In Exposing services, locate the harness-argocd-adapter endpoint. Kubernetes can take a little while to set up the Service endpoints.

Copy the endpoint URL. You do not need the port number.

Step 3: Permit the URL in Your Browser

The argo-quickstart.yaml manifest we used does not use a certificate. Consequently, you need to permit the URL in your browser.

When you use the manifests for trusted or self-signed certificates, you do not need to do this step.

Open a new tab in your browser.

Paste the Adapter URL endpoint into your browser and press enter. The browser will show the following error messages. 

  • For Firefox, you will see the error message Warning: Potential Security Risk Ahead.
    • Click Advanced, and then click Accept the Risk and Continue. The Argo CD UI will load.
  • For Google Chrome, you will see the error message Your connection is not private.
    • Click anywhere in the blank space of the page and type thisisunsafe. The Argo CD UI will load.

Now you can use the URL in your Harness account.

Step 4: Connect Argo CD Adapter to Harness

Log into Harness.

Open your Harness Project and click the Deployments module.

In Deployments, click GitOps.

Click New Adapter. The Adapter Overview page appear.

In Name, enter the name for your Adapter. For example, Quickstart.

In Adapter URL, enter the Adapter endpoint URL that you obtained from cluster.

Do not enter any trailing slash in the URL.

Click Save and Continue. The adapter is added.

Your Argo CD Server is displayed.

Log into your Argo CD Server.

Your Argo CD Application appears.

Now you can use Argo CD in Harness for GitOps.

Summary

In this tutorial, you learned how to:

  • Download and edit the Harness Argo CD Adapter Kubernetes manifest files.
  • Deploy the Harness Argo CD Adapter to the cluster running Argo CD.
  • Add the Harness Argo CD Adapter in Harness and connect Argo CD with Harness.


Please Provide Feedback