Skip to main content

Deploy using Kubernetes Manifest

This tutorial will get you started with Harness Continuous Delivery (CD). We will guide you through deploying a Guestbook application using Harness CD pipeline and GitOps methods. This Guestbook application uses a publicly available Kubernetes manifest and Docker image.

Kubernetes is required to complete these steps. Run the following to check your system resources and (optionally) install a local cluster.

bash <(curl -fsSL

Harness GitOps (built on top of Argo CD) watches the state of your application as defined in a Git repo, and can pull (either automatically, or when instructed to do so) these changes into your Kubernetes cluster, leading to an application sync. Harness GitOps supports both Argo CD and Flux CD as the GitOps reconciler.

Whether you're new to GitOps or an experienced practitioner, this guide will assist you in getting started with Harness GitOps, offering you the option to choose between Argo CD and Flux CD.

Before you begin

Verify that you have the following:

  1. A Kubernetes cluster. We recommend K3D for installing the Harness GitOps Agent and deploying a sample application in a local development environment.
  2. Fork the harnesscd-example-apps repository through the GitHub web interface.
    • For details on Forking a GitHub repository, go to GitHub docs.

Getting Started with Harness GitOps

  1. Refer Install and Configure Harness CLI doc to setup and configure Harness CLI.

  2. Clone the Forked harnessed-example-apps repo and change directory.

    git clone
    cd harnesscd-example-apps

    Replace GITHUB_ACCOUNTNAME with your GitHub Account name.

  3. Select Deployments, and then select GitOps.

GitOps Agent

What is a GitOps Agent?

A Harness GitOps Agent is a worker process that runs in your environment, makes secure, outbound connections to Harness, and performs all the GitOps tasks you request in Harness.

  1. Select Settings, and then select GitOps Agents.
    • Select New GitOps Agent.
    • When are prompted with Do you have any existing Argo CD instances?, select Yes if you already have a Argo CD Instance, or else choose No to install the Harness GitOps Agent.
  • Select No, and then select Start.

  • In Name, enter the name for the new Agent.

  • In Namespace, enter the namespace where you want to install the Harness GitOps Agent. Typically, this is the target namespace for your deployment.

    • For this tutorial, let's use the default namespace to install the Agent and deploy applications.
  • Select Continue. The Review YAML settings appear.

  • This is the manifest YAML for the Harness GitOps Agent. You will download this YAML file and run it in your Harness GitOps Agent cluster.

    kubectl apply -f gitops-agent.yml -n default
  • Select Continue and verify the Agent is successfully installed and can connect to Harness Manager.

  1. Before proceeding, store the Agent Identifier value as an environment variable for use in the subsequent commands:


    Note: Replace GITOPS_AGENT_IDENTIFIER with GitOps Agent Identifier.

  2. Create a GitOps Repository.

    harness gitops-repository --file guestbook/harness-gitops/repository.yml apply --agent-identifier $AGENT_NAME
  3. Create a GitOps Cluster.

    harness gitops-cluster --file guestbook/harness-gitops/cluster.yml apply --agent-identifier $AGENT_NAME
  4. Create a GitOps Application.

    harness gitops-application --file guestbook/harness-gitops/application.yml apply --agent-identifier $AGENT_NAME
  5. At last, it's time to synchronize the application with your Kubernetes setup.

  • Navigate to Harness UI > Default Project > GitOps > Applications, then click on gitops-application. Choose Sync, followed by Synchronize to kick off the application deployment.

    • Observe the Sync state as Harness synchronizes the workload under Resource View tab. Harness GitOps Sync Success

    • After a successful execution, you can check the deployment in your Kubernetes cluster using the following command:

    kubectl get pods -n default
    • To access the Guestbook application deployed via the Harness pipeline, port forward the service and access it at http://localhost:8080:
    kubectl port-forward svc/kustomize-guestbook-ui 8080:80


You've just learned how to use Harness GitOps to deploy an application using a Kubernetes manifest.

Continue your learning journey by learning about variables,pipeline triggers, and Harness GitOps.