No items found.
March 9, 2020

Welcome to the Harness Family, Kustomize!

Table of Contents

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. 

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.  

Under Download Delegate, select the Kubernetes YAML. 

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

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

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. 

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

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

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”

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

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. 

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

Setup -> Cloud Providers + Add Cloud Provider

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”.

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

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

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

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

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

Once you click Submit, your repository will be available. 

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

Setup -> + Add Application

Create an application named “Hello World”

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

Setup -> Hello World -> Services  + Add Service

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

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. 

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. 

Once you hit Submit the Manifests should have been linked. 

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

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

Setup -> Hello World -> Environments + Add Environment

You can add “dev” first. 

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

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. 

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

Repeat the process for the Harness Environment for prod.

Infrastructure Definition for prod.

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

Setup -> Hello World -> Workflows + Add Workflow

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

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

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

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

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

Hit Submit to run and prosper!

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

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!

You might also like
No items found.

Similar Blogs

No items found.
Continuous Delivery & GitOps