Learn KOP - Part 1 - Setup - Rafay Product Documentation

Part 1: 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 GitOps pipeline to enable System Sync to communicate with a Git repository.

Once this part is complete, in subsequent parts, you will test System Sync to sync bidirectionally, from Git to System and from System to Git.


Step 1: Create GitOps Agent

We must first create a GitOps Agent that will allow the pipeline to access our Git repository.

This will create an agent on the cluster specified. The agent will be used to communicate with the Git repository. It will take a few minutes for the agent to be deployed and become healthy.


Step 2: Create Repository

Next, we will create a repository in GitHub. This repository will be used by System Sync to store the configuration files of the resources within the organization.

This will create a new private repository in your Git system (e.g. GitHub). An example shown below.


Step 3: Add Repository

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

Optionally,


Step 4: Create Blueprint

We will now create a custom blueprint to apply to the cluster

Apply Blueprint

We now will apply the newly created blueprint to the cluster.


Step 5: 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 "nginx" on our cluster.


Step 6: Create Workload

Now, we are ready to create a test workload and publish it to the namespace we just created.

apiVersion: v1
kind: Service
metadata:
  name: nginx
spec:
  ports:
  - name: http
    port: 80
    targetPort: 8080
  selector:
    app: nginx
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  selector:
    matchLabels:
      app: nginx
  replicas: 2
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginxinc/nginx-unprivileged
        ports:
        - containerPort: 8080

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

kubectl get po -n nginx

You should see something like the following:

NAME                              READY   STATUS    RESTARTS   AGE
nginx-deployment-f5b7b79d-j54jg   1/1     Running   0          2m
nginx-deployment-f5b7b79d-lmjtk   1/1     Running   0          2m

Step 7: GitOps Pipeline

The GitOps pipeline will ensure that the resources in the system are "always kept reconciled" with the desired specifications in the Git repository. It will also ensure the Git repository is reconciled with the system if a change is made directly on the system.

We will now create a GitOps Pipeline.


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 repository is updated in Git.


Webhook in GitHub


Activate Pipeline

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


Recap

In this part, you successfully configured a GitOps pipeline to enable System Sync between the system and your Git repository. You are now ready to move to subsequent parts of the exercise to start testing System Sync.