Set Up an OCM Controller Environment

This document describes how to set up a local environment for running examples from the Deploy a Helm Chart guide. You will create a local Kubernetes cluster with kind and then install kro, Flux, and the OCM controllers.

Prerequisites

Start a Local Kubernetes Cluster With kind

You don’t need to run kind if you are using a remote Kubernetes cluster you have access to. If so, you can skip this.

Create a local kind cluster:

kind create cluster

Install kro

Please follow the official installation guides for kro. You might need helm to install kro.

Verify the installation:

kubectl get pods --all-namespaces
NAMESPACE            NAME                                         READY   STATUS             RESTARTS        AGE
...
kro                  kro-86d5b5b5bd-6gmvr                         1/1     Running            0               3h28m
...

Install a Deployer

Currently, we created our examples and getting-started guides using Flux as deployer. But, in theory, you could use any other deployer that is able to apply a deployable resource to a Kubernetes cluster, for instance Argo CD.

To install the Flux CLI, please follow the official installation guide. After you have installed the CLI tool, you can proceed with the steps below.

Install the Flux controllers:

flux install

Verify the installation:

kubectl get pods --all-namespaces
NAMESPACE            NAME                                         READY   STATUS             RESTARTS        AGE
...
flux-system          helm-controller-b6767d66-zbwws               1/1     Running            0               3h29m
flux-system          kustomize-controller-57c7ff5596-v6fvr        1/1     Running            0               3h29m
flux-system          notification-controller-58ffd586f7-pr65t     1/1     Running            0               3h29m
flux-system          source-controller-6ff87cb475-2h2lv           1/1     Running            0               3h29m
...
kro                  kro-86d5b5b5bd-6gmvr                         1/1     Running            0               3h28m
...

Install the OCM Controllers

Install the OCM controllers with one of the following commands:

# In the open-component-model repository
cd kubernetes/controller
task deploy

or

kubectl apply -k "https://github.com/open-component-model/open-component-model/kubernetes/controller/config/default?ref=main"

Verify the installation:

kubectl get pods --all-namespaces
NAMESPACE            NAME                                         READY   STATUS             RESTARTS        AGE
...
flux-system              helm-controller-b6767d66-zbwws                        1/1     Running            0               3h39m
flux-system              kustomize-controller-57c7ff5596-v6fvr                 1/1     Running            0               3h39m
flux-system              notification-controller-58ffd586f7-pr65t              1/1     Running            0               3h39m
flux-system              source-controller-6ff87cb475-2h2lv                    1/1     Running            0               3h39m
...
kro                      kro-86d5b5b5bd-6gmvr                                  1/1     Running            0               3h38m
...
ocm-k8s-toolkit-system   ocm-k8s-toolkit-controller-manager-788f58d4bd-ntbx8   1/1     Running            0               57s
...

Get Access to a Registry

As all examples and guides will create an OCM component version that will be consumed by the OCM controllers, you will need access to a registry. You can either choose a public registry like ghcr.io or deploy a registry (like registry, zot, …) into your Kubernetes cluster.

If you choose to deploy a registry into your Kubernetes cluster, you have to make sure it is accessible from outside the cluster (for ocm transfer to work) and inside the cluster (for the OCM controllers to work).

We strongly recommend to use a registry that is publicly accessible, like ghcr.io. (Deploying your own registry requires a lot of additional configuration. Especially, if you want to try out the localization example, you will need to configure a registry that is accessible with the same address from your CLI, kubelet, and inside the cluster.)


If you completed all of the above steps, you are ready to go. You can now start with the Deploy a Helm Chart guide or play around with the examples in the examples/ directory on GitHub directory.