Stage 5 · Platform
Operators, CRDs & Controllers
Operator Lifecycle
OLM bundles, channels, upgrade edges, leader election, and high-availability controllers.
OLM Overview
Operator Lifecycle Manager (OLM) manages the lifecycle of operators in a cluster. It handles installation, upgrades, and dependency management. OLM uses Catalogs (collections of packages), Packages (operator metadata), and Bundles (versioned operator manifests).
| Concept | Purpose | Analogy |
|---|---|---|
| Catalog | Collection of packages | Package repository |
| Package | Operator metadata | Package name |
| Bundle | Versioned manifests | Package version |
| Channel | Upgrade path | Release channel (stable, beta) |
Bundle Format
An OLM bundle contains all manifests for a specific operator version: CRDs, ClusterServiceVersion (CSV), and metadata. The CSV describes the operator: name, version, permissions, and dependencies.
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
name: my-operator.v1.0.0
namespace: placeholder
spec:
displayName: My Operator
description: Manages WebApp resources
version: 1.0.0
minKubeVersion: "1.25.0"
maturity: alpha
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- name: webapps.platform.example.com
kind: WebApp
version: v1
displayName: WebApp
install:
spec:
deployments:
- name: my-operator
spec:
replicas: 1
template:
spec:
containers:
- name: manager
image: ghcr.io/my-org/my-operator:v1.0.0
strategy: deployment
permissions:
- serviceAccountName: my-operator
rules:
- apiGroups: ["platform.example.com"]
resources: ["webapps"]
verbs: ["*"]The CSV describes the operator to OLM: display name, version, CRDs owned, deployment spec, and RBAC rules. OLM uses this to install the operator and manage its lifecycle.
Channels
Channels define upgrade paths. stable receives only production-ready releases. beta receives pre-release versions. alpha receives experimental versions. Subscribers to a channel receive upgrades within that channel.
apiVersion: operators.coreos.com/v1
kind: PackageManifest
metadata:
name: my-operator
namespace: olm
status:
catalogSource: my-catalog
catalogSourceDisplayName: My Catalog
catalogSourcePublisher: My Org
channels:
- name: stable
currentCSV: my-operator.v1.0.0
- name: beta
currentCSV: my-operator.v1.1.0-beta.1
- name: alpha
currentCSV: my-operator.v1.2.0-alpha.1
defaultChannel: stableEach channel tracks its latest version. Subscribers to stable get v1.0.0. Subscribers to beta get v1.1.0-beta.1. The defaultChannel determines which channel is used when none is specified.
Upgrade Edges
Upgrade edges define valid version transitions. Specify skips (versions to skip), skipRange (version ranges to skip), and replaces (specific version replacements). This ensures safe upgrades.
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
name: my-operator.v1.1.0
spec:
version: 1.1.0
replaces: my-operator.v1.0.0 # Replaces v1.0.0
skipRange: ">=1.0.0 <1.1.0" # Skip versions in this range
skips:
- my-operator.v1.0.1 # Skip this specific version
- my-operator.v1.0.2replaces: v1.0.0 means v1.1.0 upgrades from v1.0.0. skipRange means versions >=1.0.0 and <1.1.0 are skipped. skips lists specific versions to skip. OLM uses these edges to determine safe upgrade paths.
Leader Election
Leader election ensures only one controller instance is active in HA setups. The leader acquires a lease in etcd. Other instances wait. If the leader dies, the lease expires and a new election occurs.
High-Availability Controllers
HA controllers run multiple replicas with leader election. Only the leader processes reconcile events. Standby replicas are ready to take over immediately. This provides failover within seconds.
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-operator
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
spec:
serviceAccountName: my-operator
containers:
- name: manager
image: ghcr.io/my-org/my-operator:v1.0.0
args:
- --leader-elect=true
- --leader-election-id=my-operator-lock
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "512Mi"
livenessProbe:
httpGet:
path: /healthz
port: 8081
readinessProbe:
httpGet:
path: /readyz
port: 80813 replicas with leader election. maxUnavailable: 0 ensures zero downtime during updates. Liveness and readiness probes detect unhealthy leaders. The standby replicas are ready to take over within seconds.
Install OLM with: operator-sdk olm install. This installs the OLM components (CatalogSource, Subscription, InstallPlan). Use operator-sdk run bundle to test your operator locally.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.