Skip to main content

Getting Started with Deployments

Last updated on

This topic walks you through creating your first deployment pipeline in Harness Continuous Delivery (CD).

New to Harness CD?

Start with the CD overview to understand key concepts, including services, environments, pipelines, and deployment strategies.


What will you learn in this topic?


Before you begin

Ensure you have the following:

  • A Harness account: Sign up for free.
  • Access to a Harness project: Use the Default Project or create your own.

Platform setup

Select your deployment platform to get started with the required setup and connectors.

Set up your Kubernetes cluster and configure the required connectors to deploy containerized applications with Harness CD.

Infrastructure requirements:

  • A Kubernetes cluster (local like K3D, or cloud-managed like GKE, EKS, AKS).
  • kubectl access to your cluster.
  • Application deployed to a container registry (Docker Hub, ECR, GCR, and so on).
  • A Harness Delegate installed: Required to connect to your cluster. Go to the delegate installation guide to install one.

Quick verification:

# Verify kubectl access
kubectl cluster-info
kubectl get nodes

Required connectors:

  • Kubernetes Cluster Connector: Connects Harness to your cluster.

    • Go to Project Settings > Connectors > New Connector > Kubernetes Cluster.
    • Choose connection method (Delegate, Service Account, and so on).
    • Go to Create a Kubernetes connector for detailed steps.
  • Git Connector: For storing Kubernetes manifests.

    • Go to Project Settings > Connectors > New Connector > GitHub/GitLab/Bitbucket.
    • Provide repository URL and authentication (Personal Access Token recommended).
    • Go to Git connector setup for detailed steps.
  • Docker Registry Connector: For pulling container images.

    • Go to Project Settings > Connectors > New Connector > Docker Registry.
    • For Docker Hub: Use https://registry.hub.docker.com/v2/.
    • For ECR/GCR/ACR: Use respective registry URLs.
    • Go to Docker Registry connector for detailed steps.

note
  • Complete all connector setups before proceeding. You select these connectors in the following steps.
  • Test each connector. Use the Test Connection button to verify connectivity.
  • Save connector identifiers. You reference these by name when configuring services and environments.

Step 1: Create your pipeline

Perform the following steps to create your first deployment pipeline:

  1. From your Harness project, select Pipelines from the left navigation menu.
  2. Click + Create a Pipeline.

Configure pipeline basics

  1. Provide a Name for your pipeline. For example, Deploy to Production.
  2. Select Inline for Pipeline Storage (stores configuration in Harness).
  3. Click Start.
note

You can also store pipelines in Git using Remote storage. Go to the Pipelines documentation for details.


Step 2: Add a Deploy stage and configure deployment

Perform the following steps to add a Deploy stage and configure your deployment based on your target platform:

  1. Select the Deploy stage type.
  1. In the About your Stage section:

    • Enter a Stage Name. For example, Deploy to Dev.
    • Select the Deployment Type that matches your infrastructure from the following:
      • Kubernetes: Deploy to any Kubernetes cluster.
      • AWS Lambda: Serverless functions on AWS.
      • Google Cloud Run: Fully managed containers on GCP.
      • Azure Web Apps: PaaS web applications on Azure.
      • Azure Functions: Serverless compute on Azure.
      • SSH: Deploy to Linux/Windows servers.
    tip

    Harness supports 20+ deployment types including ECS, Helm, SAM, Google Cloud Functions, Spot, Tanzu, and more. For the complete list, go to What's Supported in CD.

  2. Click Set Up Stage to continue.

warning

The deployment type you select here determines the configuration needed in Service, Environment, and Infrastructure sections. Make sure to follow the same deployment type throughout all configuration steps.


Step 3: Configure your service

The service defines what you are deploying (application, artifacts, manifests).

Select the deployment platform based on the requirement:

Define the Kubernetes service by adding a manifest and a container image to deploy.

Add a service

  1. In the Service tab, click + Add Service.
  2. Provide a Name. For example, nginx-service.
  3. Click Save.

Add Kubernetes manifest

  1. Click Add Manifest.
  2. Select K8s Manifest.
  3. Configure the following:
    • Manifest Identifier: k8s-manifest.
    • Git Connector: Select the Git connector you created in Platform setup.
    • Repository: Use https://github.com/harness-community/harnesscd-example-apps.
    • Branch: master.
    • File Path: guestbook/manifest.yaml.

Sample manifest:

apiVersion: apps/v1
kind: Deployment
metadata:
name: guestbook-ui
spec:
replicas: 3
selector:
matchLabels:
app: guestbook-ui
template:
metadata:
labels:
app: guestbook-ui
spec:
containers:
- name: guestbook-ui
image: <+artifact.image>
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: guestbook-ui
spec:
type: LoadBalancer
selector:
app: guestbook-ui
ports:
- protocol: TCP
port: 80
targetPort: 80

Add container image

  1. Click Add Primary Artifact.
  2. Select Docker Registry.
  3. Configure the following:
    • Artifact Source Name: nginx.
    • Docker Registry Connector: Select the Docker Registry connector you created in Platform setup.
    • Image Path: library/nginx.
    • Tag: Select stable or use <+input> for runtime input.
  4. Click Continue to proceed to environment configuration.
note

Harness also supports Helm charts and Kustomize for Kubernetes deployments.


Step 4: Configure environment and infrastructure

Perform the following steps to define where you are deploying (the environment) and the specific infrastructure details:

Select your deployment platform from the following:

Create an environment to represent your deployment target, then define the Kubernetes infrastructure to deploy to.

Create environment

  1. Click + New Environment.
  2. Configure the following:
    • Name: dev-environment.
    • Environment Type: Pre-Production.
  3. Click Save.

Define infrastructure

  1. Click + Select Infrastructure.

  2. Provide Name: k8s-dev-cluster.

  3. Configure the following:

    • Connector: Select the Kubernetes cluster connector you created in Platform setup.
    • Namespace: Enter target namespace (e.g., default, dev, production).
    • Release Name: release-<+INFRA_KEY> (for deployment tracking).
  4. Click Continue to proceed to Execution.

Go to Kubernetes infrastructure for advanced configuration options.


Step 5: Configure execution strategy

Different deployment types support different execution strategies. Select your deployment platform to view the available strategies:

Perform the following steps to configure the execution strategy for your Kubernetes deployment:

  1. In the Execution tab, Harness automatically adds a Rollout Deployment step.

  2. Click on the step to choose your execution strategy:

    Available strategies for Kubernetes:

    • Rolling: Incrementally updates pods with zero downtime. Supports all Kubernetes workloads (Deployment, DaemonSet, and so on).
    • Blue Green: Deploys new version alongside old, then switches traffic instantly. Supports Deployment workloads only.
    • Canary: Gradually routes traffic to new version in phases. Supports Deployment workloads only.
    • Blank Canvas: Start with empty execution for custom workflows.
  3. Select your strategy and click Use Strategy.

For more details on Kubernetes deployment strategies, go to What Can I Deploy in Kubernetes?.


Enable Continuous Verification (optional)

You can enable Continuous Verification to automatically monitor your application's health after deployment.

Perform the following steps to enable Continuous Verification:

  1. Toggle Enable Continuous Verification.
  2. Configure your monitoring tools, such as Application Performance Monitoring (APM), logging, and metrics.

Go to the Continuous Verification documentation to learn about verification.


Step 6: Run your pipeline

After completing all configuration steps, perform the following steps to execute your deployment:

  1. Ensure your pipeline is saved. Click Save if needed.
  2. In the Pipeline Editor, click Run in the top right corner.
  3. Provide any required runtime inputs:
    • Artifact versions or tags
    • Environment variables
    • Infrastructure parameters
  4. Click Run Pipeline to begin execution.

Harness executes your deployment and displays real-time progress, logs, and status for each step.

For detailed information on monitoring execution, viewing logs, troubleshooting failures, and understanding deployment status, go to the Pipeline Execution Walkthrough.


Next steps

Now that you have completed your first deployment, continue your Harness CD journey with the following:

tip

The harnesscd-example-apps repository contains complete working examples with manifests, configurations, and artifacts that you can fork and use in your own pipelines.

Harness CD self-paced training

For an interactive onboarding experience with advanced features like canary deployments, blue-green strategies, and automated rollbacks, go to Harness CD self-paced training.