Learn KOP - Part 1 - Setup - Rafay Product Documentation

Setup

This is Part 1 of a multi-part, self-paced quick start exercise.


What Will You Do

In part 1, you will perform a one-time configuration of a k8s YAML workload, test deployment to a cluster and automate deployments using a GitOps pipeline.

Once this part is complete, in subsequent parts, you will update the k8s YAML file to test and experience various "deployment patterns".

Estimated Time
Estimated time burden for this part is 15 minutes.


Step 1: Fork Repository

To help you get started, let us fork an existing repository.

This will create a copy of the repository in your Git system (e.g. GitHub). An example shown below.


Step 2: Add Repository

Note
It does not matter if your GitHub repo is public or private. If private, you need to provide access credentials.

Optionally,


Step 3: Create Namespace

We need to create a namespace to deploy our workload via the GitOps pipeline

In the example below, we have created a namespace called "echo" on our cluster.


Step 4: Create Workload

Now, we are ready to create a workload based on k8s manifests in our Git repository and publish it to the namespace we just created.


Step 5: Publish Workload

We are now ready to configure our workload by (a) specifying the Git repo and (b) selecting the cluster for placement.

You can also verify the status of the k8s resources using the zero trust kubectl channel.

kubectl get po -n echo

You should see something like the following

NAME                         READY   STATUS    RESTARTS   AGE
echo-blue-558b67ffd6-4xmjt   1/1     Running   0          3h17m

Step 6: GitOps Pipeline

In the previous step, we manually created and deployed a workload to your cluster. Everytime you make a change to the manifest in your Git repo, you have to remember to republish the workload i.e. the changes will "not be picked up and reconciled automatically".

With a GitOps pipeline, you can completely automate this. The GitOps pipeline will ensure that the workload on the clusters are "always kept reconciled" with desired specifications in the Git repository.


Add Stage

A pipeline can have multiple stages, with completely different actions to model your desired workflows. In this exercise, we will test with a simple, single stage pipeline.


Add Trigger

A pipeline can be executed based on an "external trigger". For example, changes to the manifests in your Git repository. In this exercise, we will configure a trigger that will receive a webhook notification when specific files in your Git repository are modified.

You will now be presented with the webhook configuration details that you need to copy/paste to your GitHub repository. Once you complete this step, the GitOps pipeline will be configured to receive webhook notifications whenever the file "echo.yaml" is updated in the Git repository.


Webhook in GitHub


Activate Pipeline

By default, newly created pipelines start life in a deactivated state.


Step 7: Test GitOps Pipeline

We are now ready to verify whether we have configured our setup properly.

Notice that the Message in the trigger is identical to what you typed in when you performed the "Git Commit" operation. Optionally, use the zero trust kubectl channel to verify if the changes have been reconciled to the cluster.

kubectl get po -n echo

You should see something like the following. Note that the number of replicas has been increased from "1" to "2".

NAME                         READY   STATUS    RESTARTS   AGE
echo-blue-558b67ffd6-4xmjt   1/1     Running   0          15m
echo-blue-558b67ffd6-fv5l9   1/1     Running   0          3m

Step 8: Access Application

Let us now test if we are able to reach our application using the LoadBalancer service.

kubectl get svc -n echo

NAME   TYPE           CLUSTER-IP     EXTERNAL-IP     PORT(S)        AGE
echo   LoadBalancer   10.0.122.112   40.118.212.71   80:32505/TCP   1h
while true; do sleep 1; curl http://<External-IP from above>;done

You should see something like the following

Blue
Blue
...etc

Recap

In this part, you successfully configured, setup and tested a GitOps pipeline to ensure that changes made to your k8s manifests are automatically reconciled with the target clusters. You are now ready to move to subsequent parts of the exercise to start testing the various "deployment patterns".