Skip to content

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:

  • Create a namespace for the workload
  • Fork a Git repository in GitHub
  • Create a repository resource on the controller
  • Create and publish a Helm workload

Step 1: Create Namespace

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

  • Navigate to the project in your Org where the cluster is located.
  • Select Infrastructure -> Namespaces
  • Click "New Namespace"
  • Enter a Name for the namespace
  • Select "Wizard" for the Type
  • Click "Save"

Create Namespace

  • Click "Save & Go To Placement"

Create Namespace

  • Select the cluster to create the namespace on
  • Click "Save & Go To Publish"

Create Namespace

  • Click "Publish"

The namespace is now published on the cluster.

Create Namespace

  • Click "Exit"

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.

  • Ensure you are logged into your GitHub.com account
  • Navigate to the public Git repository
  • Click on Fork repository
  • Select your account name to fork the repo to
  • Once complete, you should see a copy of the repository in your Git system (e.g. GitHub)
  • The Helm chart is located in the "workload" directory

Step 3: Add Repository

  • Navigate to the project in your Org where the cluster is located.
  • Select Integrations -> Repositories
  • Click "New Repository"
  • Enter a name for the repository
  • Select "Git" for Type
  • Click "Create"

New Repository

  • Provide the forked Git repo's Endpoint URL
  • Select "Internet for Reachability
  • Click "Save"

Git Endpoint

Note

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

Optionally,

  • Under Infrastructure -> Repositories, Click on validate for your repository
  • If you see a validation successful message, the controller is able to access the repository

Validate Repository


Step 4: Create Helm Workload

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

  • Navigate to the project in your Org where the cluster is located.
  • Select Applications -> Workloads
  • Click New Workload -> Create New Workload
  • Enter a Name for the Workload
  • Select "Helm 3" for the Package Type
  • Select "Pull file from repository"
  • Select "Git" for the Repository Type
  • Select the namespace that was previously created for the helm workload
  • Click "Continue"

Create Workload

  • Select the previously created repository
  • Enter "master" for the revision. This is the branch of the Git repository.
  • Enter "workload/Helm/webserver" for the Path
  • Select "Value Path"
  • Click "Add Path"
  • Enter "workload/Helm/webserver/values.yaml" for the values file path
  • Click "Save and Go To Placement"

Create Workload

  • Select the cluster where the namespace was created
  • Click "Save and Go To Publish"

Create Workload

  • Click "Publish"

The Helm workload is now published on the cluster.

Create Workload

  • Click "Exit"

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


Step 1: Create Namespace

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

  • Save the below specification file to your computer as "helm-namespace.yaml". Note, the highlighted sections in the spec will need to be updated to match your environment.
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
  • Save the updates that were made to the file
  • Execute the following command to create the namespace from the declarative spec file.

    ./rctl create namespace -f helm-namespace.yaml
    

  • Login to the web console

  • Navigate to the project in your Org where the cluster is located
  • Select Infrastructure -> Namespaces

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

Create Helm Namesapce

  • Execute the following command to publish the namespace to the cluster
    ./rctl publish namespace helm-workload
    

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

Create Helm Namesapce


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.

  • Ensure you are logged into your GitHub.com account
  • Navigate to the public Git repository
  • Click on Fork repository
  • Select your account name to fork the repo to
  • Once complete, you should see a copy of the repository in your Git system (e.g. GitHub)
  • The Helm chart is located in the "workload" directory

Step 3: Add Repository

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

  • Save the below specification file to your computer as "helm-repository.yaml". Note, the highlighted sections in the spec will need to be updated to match your environment.
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
  • Save the updates that were made to the file
  • Execute the following command to create the namespace from the declarative spec file.

    ./rctl create repository -f helm-repository.yaml
    

  • Login to the web console

  • Navigate to the project in your Org where the cluster is located
  • Select Integrations -> Repositories

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

Create Helm Repository


Step 4: Create Helm Workload

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

  • Save the below specification file to your computer as "helm-workload-resource.yaml". Note, the highlighted sections in the spec will need to be updated to match your environment.
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
  • Save the updates that were made to the file
  • Execute the following command to create the workload from the declarative spec file.

    ./rctl create workload helm-workload-resource.yaml
    

  • Login to the web console

  • Navigate to the project in your Org where the cluster is located
  • Select Applications -> Workloads

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

Create Helm Workload

  • Execute the following command to publish the workload to the cluster
    ./rctl publish workload helm-workload
    

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

Create Helm Workload

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.