Course contentsShow
← Docker, Kubernetes & CI/CD
Lesson 487 of 8027. Package Management and AutomationFree lesson

Managing Operator Lifecycle with OLM

Package your operator and utilize the Operator Lifecycle Manager to handle installation, upgrades, and dependency management in a cluster.

In this lesson, you will learn how the Operator Lifecycle Manager (OLM) automates the installation, upgrading, and dependency management of your Operators within a Kubernetes cluster.

Beyond Manual Deployments

Up to this point, you have manually deployed your Operators by running kubectl apply -f on your manifests. While this works for local development, it doesn't scale to production environments where you need to track versions, manage permissions via Role-Based Access Control (RBAC), and handle seamless upgrades. This is where OLM steps in.

OLM transforms your Operator into a "first-class citizen" by using a Catalog. Instead of applying raw YAML, you package your Operator into a ClusterServiceVersion (CSV). The CSV is a manifest that tells OLM exactly what your Operator needs to run, including:

  • The deployment configuration.
  • Required Custom Resource Definitions (CRDs).
  • RBAC permissions (ServiceAccounts, Roles, and RoleBindings).

Utilizing the Operator Lifecycle Manager

Once your Operator is packaged, OLM manages its lifecycle through two primary resources: the Subscription and the InstallPlan.

  1. Subscription: This acts as a pointer. You define which package you want to install and which "channel" (e.g., stable or beta) you wish to track.
  2. InstallPlan: When a new version is available in your catalog, OLM automatically generates an InstallPlan. This plan calculates the required resources, checks for permission compliance, and coordinates the upgrade process.

For example, when you want to update your Operator, you simply update the version in your Catalog. OLM detects this, creates an InstallPlan, and performs a rolling update of your Operator pods without human intervention:

apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: my-operator-subscription
spec:
  channel: stable
  name: my-operator
  source: my-catalog-source
  installPlanApproval: Automatic

By using OLM, you ensure that your operators are not just deployed, but managed. It handles the complex "day two" operations—like ensuring the Operator has the correct permissions before the controller starts—which prevents the common "crash-loop" issues associated with manual configuration.

Key Takeaway: OLM automates the operational burden of managing Operators by using Declarative Subscriptions and Catalog-based updates to handle installation, RBAC, and lifecycle transitions consistently across clusters.