In the race to help attain configuration and package management inside Kubernetes, Kustomize and Helm are two very popular tools to help in those domains respectively. We recently welcomed Helm V3 to the Harness Family, and we are also very excited to welcome Kustomize into the Harness Family

A common comparison is between Helm vs Kustomize. The two projects have different goals in mind; Kustomize is designed for being a configuration manager whereas Helm does not claim to be one. 

Why is Kustomize Generating Hoopla?

If you take a trip down memory lane prior to the latest release of Helm aka Helm V3, Helm required the installation of Tiller and a Helm Client. Kustomize from early on had the ability to be executed by Kubernetes’ CLI, KubeCTL.  As a configuration manager, this is important because imagine having a newly minted Kubernetes Cluster up and running, to start to leverage Kustomize would not require an additional client to be installed on the cluster itself. Harness makes leveraging Kustomize across your infrastructure and deployments a breeze. 

Get to Kustomize’ing

The Harness Kustomize Documentation is a pretty great spot to get started. Like always you can watch the video and/or follow along with the blog.

Kubernetes Infrastructure Setup

In my example, I will be using Amazon EKS and be installing a Kubernetes Delegate into the EKS Cluster. 

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

To install a Harness Kubernetes Delegate is pretty straight forward. Sign in to the Harness Platform and if you don’t have a Kubernetes Delegate running, head to Setup -> Harness Delegates.  

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Under Download Delegate, select the Kubernetes YAML. 

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Provide a name for the Harness Delegate, in this case, we can all the delegate “kustomize”.

Kubernetes Kustomize - Harness platform integration - K8s delegate setup using Amazon EKS

A tar.gz will be downloaded with all that is needed once you hit Submit. Expand the tar.gz. 

Kubernetes Kustomize - Harness platform integration - K8s delegate setup using Amazon EKS
Kubernetes Kustomize - Harness platform integration - K8s delegate setup using Amazon EKS

In the expanded folder, simply run kubectl apply -f harness-delegate.yaml to get your delegate up and running. If your KubeCTL is not wired to your EKS cluster, can run a helper method to inject the Kubeconfig with aws eks –region your-region update-kubeconfig –name your-cluster-name. 

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Can run kubectl get pods -n harness-delegate to get the status of the Harness Delegate. 

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Back in the Harness UI, can validate the Delegate is connected. 

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Once the delegate is connected, to install the Git bits into Harness Kubernetes CLI, we can make a Delegate Profile to install the Git CLI. 

Setup -> Harness Delegates -> Manage Delegate Profiles + Add Delegate Profile “Install Git”

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS
Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS
 apt-get update
 # Install Git with auto approval
 yes | apt-get install git
 # Check git install
 git --version
 

Once you hit submit, in the Delegate, click Profile -> Install Git

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

It should take a few minutes to execute. You can validate that Git has been installed by viewing the Profile Execution Log by clicking View Logs next to the Last Executed date. 

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Next, you can wire your Kubernetes Cluster to Harness as a Cloud Provider

Setup -> Cloud Providers + Add Cloud Provider

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Add a Cloud Provider called “EKS_Cluster” with a Type of Kubernetes Cluster. Since we installed the Harness Delegate into the EKS Cluster, we can inherit the details from a Delegate, in this case, the Delegate “kustomize”.

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

When you click Submit, the Kubernetes Cluster will be available for workload. 

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Once the cluster is connected, time to dig into the Kustomize pieces. 

Kustomize Workflow

The Harness Documentation for Kustomize is an excellent resource on getting you started. For this example, you will leverage Kustomize’s Multibases example showing off the use of environmental variants e.g dev/production as overlays

Multibase Example

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Next, you will need to wire up the Kustomize GitHub repository to Harness. 

Setup -> Connectors -> Source Repo Providers + Add Source Repo Provider

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Add the Repository Details for https://github.com/kubernetes-sigs/kustomize including your GitHub credentials and specify master as the Branch Name. 

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

Once you click Submit, your repository will be available. 

Kubernetes Kustomize - Harness platform integration - K8s infrastructure setup using Amazon EKS

You can now create a Harness Application to try out the Kustomzie integration.

Setup -> + Add Application

Kubernetes Kustomize - Harness platform integration - create a Harness application

Create an application named “Hello World”

Kubernetes Kustomize - Harness platform integration - create a Harness application

Once you click Submit, you can create a Harness Service.

Setup -> Hello World -> Services  + Add Service

Kubernetes Kustomize - Harness platform integration - create a Harness application

Create a service called “Multibases” with a Deployment Type of Kubernetes

Kubernetes Kustomize - Harness platform integration - create a Harness application

Once you hit Submit, time to wire up the Kustomization Configuration. In the Manifests section of the Multibases Service, click on the ellipses -> Link Remote Manifests. 

Kubernetes Kustomize - Harness platform integration - create a Harness application

When linking the Remote Manifests, select Kustomization Configuration. The Source Repository will be the GitHub Repository you linked up earlier. For the Path to the kustomization directory, this will be examples/multibases/${env.name}. With the variable for env.name, we can point to a specific environment. 

Kubernetes Kustomize - Harness platform integration - create a Harness application

Once you hit Submit the Manifests should have been linked. 

Kubernetes Kustomize - Harness platform integration - create a Harness application

When creating a Harness Environment, we can mimic the Multibases Example structure. 

Kubernetes Kustomize - Harness platform integration - create a Harness environment

You can Create two Harness Environments, “dev” and “production”.

Setup -> Hello World -> Environments + Add Environment

Kubernetes Kustomize - Harness platform integration - create a Harness environment

You can add “dev” first. 

Kubernetes Kustomize - Harness platform integration - create a Harness environment

Once you click Submit, you can add an Infrastructure Definition. 

Kubernetes Kustomize - Harness platform integration - create a Harness environment

Create an Infrastructure Definition with Name dev_eks as a Cloud Provider Type Kubernetes Cluster, Deployment Type of Kubernetes, and select the Cloud Provider for the Kubernetes Cluster you wired before. 

Kubernetes Kustomize - Harness platform integration - create a Harness environment

Once you click Submit, your Infrastructure Definition will be available. 

Kubernetes Kustomize - Harness platform integration - create a Harness environment

Repeat the process for the Harness Environment for prod.

Kubernetes Kustomize - Harness platform integration - create a Harness environment

Infrastructure Definition for prod.

Kubernetes Kustomize - Harness platform integration - create a Harness environment

Now you can create a Harness Workflow to run your Kustomization Deployment.  

Setup -> Hello World -> Workflows + Add Workflow

Kubernetes Kustomize - Harness platform integration - create a Harness workflow

We can set up our Hello Kustomzie Workflow. For now have the Workflow point to your dev infrastructure. 

Kubernetes Kustomize - Harness platform integration - create a Harness workflow

Once created, we can add a Workflow Variable by expanding the Workflow Variables section and clicking on the pencil icon. 

Kubernetes Kustomize - Harness platform integration - create a Harness workflow

Create a Workflow Variable called Environment and add dev, production to the list as to mimic the Multibases Example and your Harness Environments. 

Kubernetes Kustomize - Harness platform integration - create a Harness workflow

Once you click Save, now you can run your first example. In the Workflow Overview click Deploy. 

Kubernetes Kustomize - Harness platform integration - create a Harness workflow

In the Start New Deployment window, select dev as the Environments Value.

Kubernetes Kustomize - Harness platform integration - create a Harness workflow

Hit Submit to run and prosper!

Kubernetes Kustomize - Harness platform integration - Harness workflow execution

You can also pop into the Kubernetes UI and see the Config Maps being created/appended to. 

Kubernetes Kustomize - Harness platform integration - K8s UI Configuration maps

Congratulations on your first Kustomize Deployment!  At Harness, we are here to partner with you. 

Harness – Your Partner in Kubernetes

Many organizations are going through the Kubernetes journey. At Harness, we are the definitive Continuous Delivery platform for workloads on and off of Kubernetes. Getting Kustomize support has been championed by our customers and community alike. As the Kubernetes ecosystem continues to evolve and mature, Harness will be there. Feel free to take the Harness Software Delivery Platform out for a spin and sign up today!

Cheers,

-Ravi

Keep Reading