In this lesson, you will learn how to transition from running raw operator manifests to using the Operator Lifecycle Manager (OLM) to standardize deployment, versioning, and lifecycle management.
While building a controller is the first step, distributing it across teams or clusters manually is error-prone. OLM acts as a "package manager" for Kubernetes, transforming your operator into a versioned, installable resource that handles dependency resolution and automatic upgrades.
The Bundle: The Packaging Unit
To package your operator for OLM, you bundle your Kubernetes manifests (CRDs, RBAC, and the operator deployment) into a single directory or container image called a Bundle. This bundle includes a critical file, manifests/cluster-service-version.yaml (CSV). The CSV acts as the "metadata manifest" for your operator, declaring:
- Which CRDs the operator manages.
- Required RBAC permissions.
- The deployment configuration (the container image of your controller).
- The semantic version of the operator.
Packaging with OLM
Once your bundle is ready, you define a CatalogSource. Think of this as your private app store. You bundle your operator into a catalog image—a database containing one or more operator bundles—and deploy it to your cluster.
When you create an OperatorGroup and a Subscription in your namespace, OLM monitors your CatalogSource. It automatically detects the latest version, installs the CRDs, creates the necessary RoleBindings, and deploys your controller pod.
# Example Subscription to trigger OLM installation
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: my-operator-sub
namespace: operators
spec:
channel: stable
name: my-operator
source: my-catalog
sourceNamespace: olm
By using OLM, you offload the "heavy lifting" of lifecycle management. Instead of running kubectl apply for every update, you simply push a new bundle to your catalog. OLM will identify the new version, perform the upgrade according to your update strategy, and ensure the operator's dependencies are satisfied before transitioning. This provides a clean, automated path for Day 2 operations, mirroring the maturity we applied previously to Helm chart registries.
Key Takeaway: OLM turns your operator into a first-class package by using Bundles and Subscriptions to automate installation, versioning, and dependency resolution across your cluster.