Skip to main content

Kubernetes Deployments Basics

This topic describes the concept of a Harness Kubernetes deployment by describing the high-level steps involved.

For a quick tutorial, see the Kubernetes deployment tutorial.

Before You Begin

Before learning about, you should have an understanding of the following:

What Does Harness Need Before You Start?

A Harness Kubernetes deployment requires the following:

  1. Kubernetes manifests and values YAML files.
  2. Artifact, if not hardcoded in manifests or values file. For example, a Docker image of NGINX from Docker Hub.
  3. Kubernetes cluster: You will need a target cluster for the Harness Delegate, your app, and your Kubernetes workloads. Your cluster should have enough RAM to host the Delegate and your apps and workloads.

What Does Harness Deploy?

Harness takes the artifacts and Kubernetes manifests you provide and deploys them to the target Kubernetes cluster. You can simply deploy Kubernetes objects via manifests. You can provide manifests using remote sources and Helm charts.

What is a Workload in Harness?

Harness deployments involve different strategies and steps. These strategies and steps support different Kubernetes objects as managed and unmanaged workloads.

See What Can I Deploy in Kubernetes? for details on each strategy and workload support.

The following tables provide a useful summary.

Managed Workloads Table

In Harness, a managed Kubernetes workload is a Kubernetes object deployed and managed to steady state. If steady state is not reached, the deployment is considered a failure and the Failure Strategy is executed (typically rollback).

ApplyRollingRollbackBlue GreenCanaryScale
1 Deployment or StatefulSet mandatory/allowed
1 Deployment or StatefulSet mandatory/allowed
1 Deployment or StatefulSet mandatory/allowed
1 Deployment or StatefulSet mandatory/allowed
Any ObjectYesNoNoNoNoNo

Unmanaged Workloads Table

To deploy an object outside of the managed workloads in any strategy, you use the Harness annotation to make it unmanaged: "true"|"false". Set to true to make a manifest an unmanaged workload.

For example, Harness Canary and Blue/Green steps support a single Deployment or StatefulSet workload as a managed entity, but you can deploy additional workloads as unmanaged using the annotation.

ApplyRollingRollbackBlue GreenCanaryScale
Any ObjectYesYesNoYes:
1 Deployment or StatefulSet mandatory/allowed
1 Deployment or StatefulSet mandatory/allowed

What Does a Harness Kubernetes Deployment Involve?

All the steps necessary can be performed inline with creating your CD Pipeline. You can also set up resources like Connectors in your Resources and then select them within your Pipeline.

The following list describes the major steps of a Harness Kubernetes deployment. We assume you have a Harness Project set up.

StepNameDescription and Links
1Install the Harness Kubernetes Delegate in your Kubernetes cluster. Typically, the Kubernetes Delegate is installed in the target cluster where you will deploy your application(s).
See Install a Kubernetes Delegate.
2Add Harness Connectors.Add a Harness Connector for you artifact repo and target cluster.
For example, a Docker Registry Artifact Server that connects to the Docker registry where your Docker images are located, or the public Docker Hub.You can connect to specific target cloud platforms hosting your cluster or simply make a platform-agnostic connection to the cluster.
This can be done inline while creating your Pipeline, or separately in your Resources.
See Connect to an Artifact Repo and Kubernetes Cluster Connector Settings Reference.
3Define the Harness Service using the Kubernetes Deployment Type.Add your Docker images and Kubernetes manifests and any config variables and files.
See Add Container Images for Kubernetes Deployments.
6Define the Harness Environment and Infrastructure Definition for your target Kubernetes clusters, and any overrides.Using the Harness Connector you set up, you can select the target Kubernetes cluster and namespace for your deployment.
See Define Your Kubernetes Target Infrastructure.
7Add the Canary, Blue/Green, or Rollout steps to the Deploy stage.The stage deploys the artifact(s) and Kubernetes workloads defined in the Harness Service to the cluster and namespace in the Infrastructure Definition.
See: Create a Kubernetes Rolling Deployment, Create a Kubernetes Canary Deployment, Create a Kubernetes Blue/Green Deployment
8Deploy the Pipeline.Once you've deployed a Pipeline, learn how to improve your Kubernetes CD in Kubernetes how-tos.

Next Steps

Read the following topics to build on what you've learned: