15.1. What are Operators
Table of Contents
Concept and Motivation
In Kubernetes and OpenShift, many platform features and add‑ons start as “someone’s controller + a bunch of YAML + runbooks.” As clusters grow, this model becomes hard to operate and standardize.
Operators were introduced to solve this by turning operational knowledge into software:
- They are Kubernetes-native applications that manage the entire lifecycle of another application or platform component.
- They encode human operational expertise (installation, upgrades, recovery, tuning) into automated, declarative logic.
- They use Kubernetes APIs and patterns (custom resources, reconciliation loops) instead of out‑of‑band scripts or manual steps.
In OpenShift, Operators are central to how the platform itself is installed, configured, and kept healthy.
Definition
An Operator is:
A Kubernetes controller (or set of controllers) that uses Custom Resource Definitions (CRDs) to manage a specific application or capability, automating its lifecycle in a way that mimics a skilled human operator.
Key characteristics:
- API-driven: Exposes one or more custom APIs via CRDs.
- Reconciler-based: Continuously compares desired state (from CRs) with actual state and takes actions to align them.
- Lifecycle-aware: Knows how to install, configure, upgrade, scale, heal, and sometimes backup/restore the thing it manages.
- Domain-specific: Encodes knowledge specific to a database, message queue, monitoring system, or platform feature.
Core Building Blocks
While detailed mechanics belong to later chapters, it is important here to understand the basic ingredients that make an Operator:
- Custom Resource Definition (CRD)
- Extends the Kubernetes API with new resource types (for example,
Kafka,EtcdCluster,ServiceMeshControlPlane). - Lets users express high‑level intent using YAML, just like built‑in resources.
- Custom Resource (CR)
- An instance of a CRD that declares the desired state (for example, “a 3‑node database cluster with encryption enabled”).
- Users create/edit CRs; the Operator watches and reacts.
- Controller / Reconciliation Loop
- The Operator’s business logic that:
- Watches for changes to relevant resources (CRs and built‑in objects).
- Computes the difference between desired and actual state.
- Performs actions (create/update/delete Kubernetes resources, call APIs, etc.) until the cluster reaches the desired state.
What Problems Operators Solve
Operators aim to remove manual, error‑prone procedures and replace them with consistent automation that works across clusters and environments. Typical challenges they address:
- Complex installation
- Multi-component systems with many manifests, ordering requirements, and dependencies.
- Operator: creates all required Kubernetes objects in the right order from a single CR.
- Configuration drift
- Manual tweaks over time lead to inconsistent and fragile setups.
- Operator: treats the CR as the single source of truth and continually enforces it.
- Upgrades and compatibility
- Coordinating multi-step upgrades, schema migrations, API version changes.
- Operator: implements version‑aware upgrade paths and validations.
- High availability and self‑healing
- Detecting failed instances, rebalancing, or reconfiguring clustering.
- Operator: monitors health via Kubernetes status and app‑specific checks and reacts automatically.
- Operational consistency across teams
- Different admins applying different procedures.
- Operator: standardizes operational behavior behind a declarative API.
How Operators Differ from Plain YAML and Helm Charts
Without Operators, you typically:
- Apply static manifests (or Helm charts) to create resources.
- Rely on:
- Manual processes (runbooks).
- External automation (scripts, Ansible, CI jobs) to handle lifecycle tasks.
Operators differ in several ways:
- Stateful, continuous control vs. one-time templating
- Helm: renders and applies templates once; “upgrade” is another apply with new templates.
- Operator: constantly reconciles, reconfigures, and heals over time.
- Domain logic vs. generic templating
- Operators can:
- Talk to app-specific APIs.
- Inspect internal health/metrics.
- Orchestrate multi-step operations (e.g., rolling config changes with app‑level checks).
- Platform visibility and integration
- Operators use the Kubernetes control loop model directly: they are first‑class controllers that the cluster can introspect and manage.
Types and Levels of Operators
Not all Operators are equally sophisticated. They vary in what parts of the lifecycle they automate.
Common capabilities levels (conceptually):
- Basic install/configure
- Install components when a CR is created.
- Update resources when CRs change.
- Upgrades and version management
- Coordinate rolling upgrades.
- Understand version compatibility and block unsafe transitions.
- Health management and repair
- Detect pod or instance failures and recreate/replace them.
- Reconcile replication factors or cluster membership.
- Day‑2 operations
- Perform and manage backups/restores.
- Run scheduled maintenance tasks and tuning.
- Autonomous operations
- Reactive scaling or topology changes based on metrics.
- Policy‑driven reconfiguration or failover.
In OpenShift, you will encounter Operators at multiple levels of sophistication, depending on their purpose.
Operators in the OpenShift Context
While the overall “Operators and Platform Services” chapter covers the ecosystem and management aspects, this section focuses on what distinguishes Operators in OpenShift’s design:
- Core platform managed by Operators
Many built‑in OpenShift capabilities (networking, ingress, storage, authentication, cluster version) are themselves controlled by Operators. You typically configure the platform by editing custom resources they own. - Standardized delivery via Operator packaging
Operators in OpenShift are published and installed with metadata describing: - Which APIs (CRDs) they provide.
- What versions they support.
- Upgrade paths between versions.
- Opinionated automation for production use
Operators shipped with OpenShift aim to encode Red Hat’s recommended operational practices for running those components reliably.
Example: High-Level Operator Workflow
Conceptually, using an Operator looks like this:
- The Operator (and its CRDs) are available in the cluster.
- A user creates a custom resource, for example:
apiVersion: example.com/v1
kind: ExampleApp
metadata:
name: example
spec:
replicas: 3
storageSize: 100Gi
enableTLS: true- The Operator:
- Sees this new
ExampleAppCR. - Creates/updates Deployments, Services, PersistentVolumeClaims, Secrets, etc.
- Configures the application to run with 3 replicas, 100Gi storage, TLS enabled.
- If a node fails or a pod is deleted:
- Kubernetes restarts pods.
- The Operator may also:
- Reassign roles in the cluster.
- Reconfigure peers.
- Ensure the application remains in the desired state.
- If the user edits the CR to change
replicas: 5: - The Operator adjusts the underlying resources and application configuration accordingly.
Benefits and Trade-Offs
Benefits
- Operational automation: Encapsulates complex logic so users interact with a simpler, declarative interface.
- Consistency: Same behavior across clusters and environments.
- Upgradability: Built‑in, tested upgrade paths for many components.
- Integration: Native use of Kubernetes primitives (RBAC, namespaces, events, conditions, statuses).
Trade‑offs
- Abstraction complexity: Users must understand the CRD’s model and semantics.
- Dependency on Operator quality: Bugs or limitations in Operators can affect the managed component.
- Ecosystem variance: Different Operators may expose different conventions or levels of automation.
When to Use Operators
In the context of OpenShift, Operators are especially suitable when you need to:
- Manage stateful or complex systems (databases, queues, monitoring stacks, service meshes).
- Provide shared platform services to many applications.
- Offer self‑service capabilities to developers without giving them low‑level access to sensitive platform components.
- Standardize and automate day‑2 operations (upgrades, backups, tuning) across clusters.
Later chapters will cover how Operators are installed, managed, and which platform services they typically provide in OpenShift. Here, the key takeaway is that Operators are the primary pattern for expressing and automating operational expertise as Kubernetes‑native software.
Views: 0
Where to Move
Move chapter:
- ☰ 1. Course Overview
- ☰ 1.1. What is OpenShift
- ☰ 1.2. Why OpenShift is used in modern IT and cloud environments
- ☰ 1.3. OpenShift vs Kubernetes
- ☰ 1.4. Typical OpenShift use cases
- ☰ 1.5. Structure and goals of the course
-
- ☰ 2. Containers and Cloud-Native Fundamentals
- ☰ 2.1. What is a container
- ☰ 2.2. Containers vs virtual machines
- ☰ 2.3. Introduction to Docker and container images
- ☰ 2.4. Container registries
- ☰ 2.5. Basics of cloud-native applications
-
- ☰ 3. Kubernetes Fundamentals
- ☰ 3.1. What is Kubernetes
- ☰ 3.2. Kubernetes architecture
- ☰ 3.3. Control plane components
- ☰ 3.4. Worker node components
- ☰ 3.5. Kubernetes objects and resources
- ☰ 3.6. Declarative configuration model
-
- ☰ 4. OpenShift Architecture
- ☰ 4.1. Overview of OpenShift architecture
- ☰ 4.2. Control plane in OpenShift
- ☰ 4.3. Nodes and machine roles
- ☰ 4.4. OpenShift Operators
- ☰ 4.5. OpenShift networking model
- ☰ 4.6. OpenShift storage model
-
- ☰ 5. OpenShift Installation and Deployment Models
- ☰ 5.1. OpenShift deployment options
- ☰ 5.2. Installer-Provisioned Infrastructure
- ☰ 5.3. User-Provisioned Infrastructure
- ☰ 5.4. Managed OpenShift services
- ☰ 5.5. Single-node OpenShift
- ☰ 5.6. Cluster lifecycle management
-
- ☰ 6. Accessing and Using OpenShift
- ☰ 6.1. OpenShift web console
- ☰ 6.2. OpenShift CLI (oc)
- ☰ 6.3. Authentication and authorization
- ☰ 6.4. Projects and namespaces
- ☰ 6.5. Resource quotas and limits
-
- ☰ 7. Building and Deploying Applications
- ☰ 7.1. Application deployment concepts
- ☰ 7.2. Source-to-Image (S2I)
- ☰ 7.3. Container-based deployments
- ☰ 7.4. DeploymentConfigs and Deployments
- ☰ 7.5. Rolling updates and rollbacks
-
- ☰ 8. Networking in OpenShift
- ☰ 8.1. Services and service discovery
- ☰ 8.2. Routes and ingress
- ☰ 8.3. Network policies
- ☰ 8.4. Load balancing
- ☰ 8.5. External access to applications
-
- ☰ 9. Storage in OpenShift
- ☰ 9.1. Persistent storage concepts
- ☰ 9.2. Persistent Volumes
- ☰ 9.3. Persistent Volume Claims
- ☰ 9.4. StorageClasses
- ☰ 9.5. Dynamic provisioning
- ☰ 9.6. Stateful applications
-
- ☰ 10. Configuration and Secrets Management
- ☰ 10.1. ConfigMaps
- ☰ 10.2. Secrets
- ☰ 10.3. Environment variables
- ☰ 10.4. Managing sensitive data
- ☰ 10.5. Best practices for configuration
-
- ☰ 11. Scaling and High Availability
- ☰ 11.1. Horizontal pod autoscaling
- ☰ 11.2. Vertical scaling
- ☰ 11.3. Self-healing and pod restarts
- ☰ 11.4. High availability concepts
- ☰ 11.5. Multi-zone and multi-region clusters
-
- ☰ 12. Monitoring, Logging, and Observability
- ☰ 12.1. Built-in monitoring stack
- ☰ 12.2. Metrics and alerts
- ☰ 12.3. Logging architecture
- ☰ 12.4. Distributed tracing
- ☰ 12.5. Troubleshooting applications
-
- ☰ 13. Security in OpenShift
- ☰ 13.1. Security model overview
- ☰ 13.2. Role-Based Access Control
- ☰ 13.3. Security Context Constraints
- ☰ 13.4. Image security and scanning
- ☰ 13.5. Network security
- ☰ 13.6. Compliance and auditing
-
- ☰ 14. CI/CD and DevOps with OpenShift
- ☰ 14.1. DevOps concepts
- ☰ 14.2. CI/CD pipelines overview
- ☰ 14.3. OpenShift Pipelines (Tekton)
- ☰ 14.4. GitOps with Argo CD
- ☰ 14.5. Integrating OpenShift with external CI tools
-
- ☰ 15. Operators and Platform Services
- ☰ 15.1. What are Operators
- ☰ 15.2. Operator Lifecycle Manager
- ☰ 15.3. Installing and managing Operators
- ☰ 15.4. Common platform Operators
- ☰ 15.5. Custom Operators
-
- ☰ 16. Upgrades, Maintenance, and Operations
- ☰ 16.1. OpenShift upgrade process
- ☰ 16.2. Backup and restore
- ☰ 16.3. Node maintenance
- ☰ 16.4. Cluster troubleshooting
- ☰ 16.5. Capacity planning
-
- ☰ 17. OpenShift on HPC and Specialized Workloads
- ☰ 17.1. Running batch workloads on OpenShift
- ☰ 17.2. OpenShift and GPUs
- ☰ 17.3. MPI and parallel workloads in containers
- ☰ 17.4. Hybrid HPC and cloud workflows
-
- ☰ 18. OpenShift in Practice
- ☰ 18.1. Typical OpenShift workflows
- ☰ 18.2. Development to production lifecycle
- ☰ 18.3. Case studies from industry
- ☰ 18.4. Common pitfalls and best practices
-
- ☰ 19. Future Directions and Ecosystem
- ☰ 19.1. Kubernetes ecosystem overview
- ☰ 19.2. OpenShift roadmap
- ☰ 19.3. Serverless and event-driven workloads
- ☰ 19.4. AI and data platforms on OpenShift
-
- ☰ 20. Final Project and Hands-On Exercises
- ☰ 20.1. Deploying a containerized application
- ☰ 20.2. Implementing CI/CD with OpenShift
- ☰ 20.3. Securing and scaling an application
- ☰ 20.4. Monitoring and troubleshooting report
-
Comments
Please login to add a comment.
Don't have an account? Register now!