What is a Kubernetes operator?

by Michael C. Jaeger on 23 February 2024

A Kubernetes operator is an application-specific software extension automating application management and operations tasks on Kubernetes. Kubernetes is the open source, industry-standard platform for deploying, managing and scaling containerized applications – and applications on Kubernetes are easier with operators.

Operators take a real-world operations team’s knowledge, wisdom, and expertise, and codify it into a computer program that helps operating complex server applications like databases, messaging systems, or web applications. Operators provide implementations for operating applications that are testable and thus more reliable at runtime.

While operators are equally applicable to application and infrastructure operations on other platforms, today they are mainly associated with Kubernetes. Kubernetes provides many functions for operating applications out-of-the-box, with operational tasks, including scaling, upgrading, or configuring applications, covered already. However, these tasks become complex and are repetitive, in particular with stateful applications, such as database servers. Kubernetes operators extend the functionality of the Kubernetes platform with automation to cover all the complex and repetitive commands and tasks.

Why are Kubernetes operators important?

Today’s IT can choose between operating applications on its own or taking a hosted service from public cloud providers. Users expect at least the same service level from hosting and operating applications in-house as from these providers. Consequently, site reliability engineers and DevOps teams use Kubernetes operators to reach public cloud providers’ performance and reliability levels. For them, operators are popular because they automate repetitive tasks and help to reduce the complexity of operations on the powerful but sophisticated Kubernetes platform.

Read our White Paper: A guide to Kubernetes Operators

How does a Kubernetes operator work? 

A fundamental concept is that for every application there is one operator which covers all the knowledge about this application in various use cases. The operator concept includes a controller which watches the state of the application. In addition, the operator implements the application-specific operational tasks and executes them depending on defined events or commands by the user. If necessary, the operator interacts with the Kubernetes platform to control resources for deployed applications as required. For a more detailed explanation of the concepts of a Kubernetes operator, see our recent series on the software operator design pattern.

Are Kubernetes operators open source?

Yes, many Kubernetes operators are open source, for example an operator for the popular database server PostgreSQL, or the operator for the event streaming platform Kafka. Different operators can be arranged to manage a composition of applications, for example, to form an observability stack, including Grafana and Prometheus. Marketplaces provide a central location in the web for finding all relevant operators belonging to an ecosystem – for these examples the marketplace is charmhub.io.

For operators, an additional type of software has emerged, also available as open source: an orchestration engine enabling the deployment, integration and lifecycle management of applications using the operators. This engine also provides the interface to interact with one or multiple operators, via a CLI, via an API, using client libraries or using Web-based dashboards. In addition, the orchestration engine usually provides an abstraction layer covering different deployment substrates, such as multiple Kubernetes clusters on public and private clouds at the same time. Canonical’s open source software Juju is an example of an orchestration engine for Kubernetes operators.

How do you create your own Kubernetes operators?

The best way to create a Kubernetes operator is using a framework. A framework provides common, mature and proven elements for every operator. Reusing these frameworks accelerates development and results in a more reliable implementation. In addition the framework may contain runtime software, managing the lifecycle of an operator. To choose the right framework, consider the following:

  • Open source frameworks are often backed by large communities. Community contributions can improve the framework and also result in new operators for the ecosystem.
  • Some public cloud providers also offer solutions for building operators, but not all of them offer a separate management runtime to use the same technology for local Kubernetes installations.
  • A central website for available Kubernetes operators is beneficial for the community and helps identifying suitable operators in one place.
  • Most frameworks support Kubernetes and containerised applications; only a few also cover virtual machines for the integration between cloud native applications and legacy workloads.
  • The programming language of the framework plays a key role when it comes to popularity and potential contributors writing more Kubernetes operators. Most frameworks are implemented in Go or Python. Python is popular and well-known among engineers and IT admins.

Build Kubernetes operators easily with the Charm SDK and Juju

Canonical’s experience building private clouds and running managed applications over the past years has led to a comprehensive software development kit for operators: the Charm SDK. The Charm SDK comprises a framework and tools for building, packaging and testing Kubernetes operators. In addition, Canonical provides Juju, an open-source orchestration engine for Kubernetes operators that enables applications’ deployment, integration and lifecycle management at any scale.

Learn More about Kubernetes operators 

There is a lot to discover about Juju and the Charm SDK; please have a look at the linked resources below. You can also check out the presentations from our recent Operator Day events to learn how to build operators and see examples of operators for popular open-source applications.

More questions about operators, Juju and charms?

Contact Canonical

(Photo by Sivani Bandaru on Unsplash)

Related posts

Operate popular open source on Kubernetes – Attend Operator Day at KubeCon EU 2024

Operate popular open source on Kubernetes – Attend Operator Day at KubeCon EU 2024 […]

Understanding roles in software operators

In today’s blog we take a closer look at roles – the key elements that make up the design pattern – and how they work together to simplify maintaining application infrastructure. […]

Missed Operator Day at KubeCon NA 2023? – Catch the Replay!

If you missed Operator Day, we have good news: starting January 4th, we will present weekly on-demand events week covering the presentations step by step. […]