Learn KOP - Helm Workload - Rafay Product Documentation

Part 2: Helm

This is Part 2 of the exercise that will focus on deploying a Helm based workload from a Git repository


What Will You Do

In part 2, you will:


Step 1: Create Namespace

In this step, we will create a namespace through the UI.

The namespace is now published on the cluster.


Step 2: Fork Git Repository

Helm charts for the sample workload are available in a Git repository

To get started, let us fork an existing repository.


Step 3: 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 4: Create Helm Workload

In this step, we will create and publish a Helm workload from the forked repository.

The Helm workload is now published on the cluster.

Additionally, you can use the Zero Trust KubeCTL access to check the workload running on the cluster.


Step 1: Create Namespace (RCTL CLI)

In this step, we will create a namespace using the RCTL CLI.

kind: ManagedNamespace
apiVersion: config.rafay.dev/v2
metadata:
  name: helm-workload
  labels:
  annotations:
spec:
  type: RafayWizard
  resourceQuota:
  placement:
    placementType: ClusterSpecific
    clusterLabels:
    - key: rafay.dev/clusterName
      value: workload-gs

Update the following section of the specification file with the name of the cluster in your environment.

value: workload-gs
./rctl create namespace -f helm-namespace.yaml

You will see the namespace has been created, but has not been published

./rctl publish namespace helm-workload

In the web console, you will see the namespace is now published.


Step 2: Fork Git Repository (RCTL CLI)

Helm charts for the sample workload are available in a Git repository

To get started, let us fork an existing repository.


Step 3: Add Repository (RCTL CLI)

In this step, we will create a repository in the controller using the RCTL CLI.

apiVersion: config.rafay.dev/v2
kind: Repository
metadata:
  name: workload-gs
spec:
  repositoryType: GitRepository
  endpoint:  https://github.com/timrafay/getstarted-1.git
  credentialType: CredentialTypeNotSet

Update the following section of the specification file with the URL endpoint for your forked repository in GitHub.

endpoint:  https://github.com/timrafay/getstarted-1.git
./rctl create repository -f helm-repository.yaml

You will see the namespace has been created, but has not been published


Step 4: Create Helm Workload (RCTL CLI)

In this step, we will create and publish a Helm workload from the forked repository using the RCTL CLI.

name: helm-workload
namespace: helm-workload
project: defaultproject
type: Helm3
clusters: workload-gs
repository_ref: workload-gs
repo_artifact_meta:
  git:
    repoArtifactFiles:
    - fileType: HelmChartFile
      name: nginx
      relPath: workload/Helm/webserver
    - fileType: HelmValuesFile
      name: value
      relPath: workload/Helm/webserver/values.yaml
    revision: master

Update the following section of the specification file with the name of the previously created namespace.

namespace: helm-workload

Update the following section of the specification file with the name of the project where the workload should be created. This should be the same project as the cluster you are using.

project: defaultproject

Update the following section of the specification file with the name of the cluster where the workload will be deployed.

clusters: workload-gs

Update the following section of the specification file with the name of the repository resource that was created earlier in this section.

repository_ref: workload-gs
./rctl create workload helm-workload-resource.yaml

You will see the Helm workload has been created, but has not been published

./rctl publish workload helm-workload

In the web console, you will see the workload is now published.

Additionally, you can use the Zero Trust KubeCTL access to check the workload running on the cluster.


Recap

Congratulations! You have successfully deployed a Helm workload from a Git repository to your cluster.