Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
The Kubernetes Operator Framework Book

You're reading from   The Kubernetes Operator Framework Book Overcome complex Kubernetes cluster management challenges with automation toolkits

Arrow left icon
Product type Paperback
Published in Jul 2022
Publisher Packt
ISBN-13 9781803232850
Length 328 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Michael Dame Michael Dame
Author Profile Icon Michael Dame
Michael Dame
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Part 1: Essentials of Operators and the Operator Framework
2. Chapter 1: Introducing the Operator Framework FREE CHAPTER 3. Chapter 2: Understanding How Operators Interact with Kubernetes 4. Part 2: Designing and Developing an Operator
5. Chapter 3: Designing an Operator – CRD, API, and Target Reconciliation 6. Chapter 4: Developing an Operator with the Operator SDK 7. Chapter 5: Developing an Operator – Advanced Functionality 8. Chapter 6: Building and Deploying Your Operator 9. Part 3: Deploying and Distributing Operators for Public Use
10. Chapter 7: Installing and Running Operators with the Operator Lifecycle Manager 11. Chapter 8: Preparing for Ongoing Maintenance of Your Operator 12. Chapter 9: Diving into FAQs and Future Trends 13. Chapter 10: Case Study for Optional Operators – the Prometheus Operator 14. Chapter 11: Case Study for Core Operator – Etcd Operator 15. Other Books You May Enjoy

Managing Operators with OLM

OLM is the second pillar of the Operator Framework. Its purpose is to facilitate the deployment and management of Operators in a Kubernetes cluster. It is a component that runs within a Kubernetes cluster and provides several commands and features for interacting with Operators.

OLM is primarily used for the installation and upgrade of Operators—this includes fetching and installing any dependencies for those Operators. Users interact with OLM via commands provided by the Operator SDK binary, the Kubernetes command-line tool (kubectl), and declarative YAML.

To get started, OLM can be initialized in a cluster with the following command:

$ operator-sdk olm install

Besides installing Operators, OLM can also make Operators that are currently installed discoverable to users on the cluster. This provides a catalog of already installed Operators available to cluster users. Also, by managing all the known Operators in the cluster, OLM can watch for conflicting Operator APIs and settings that would destabilize the cluster.

Once an Operator's Go code is compiled into an image, it is ready to be installed into a cluster with OLM running. Technically, OLM is not required to run an Operator in any cluster. For example, it is completely possible to deploy an Operator manually in the cluster, just as with any other container-based application. However, due to the advantages and security measures described previously (including its ability to install Operators and its awareness of other installed Operators), it is highly recommended to use OLM to manage cluster Operators.

When developing an Operator, the image is compiled into a bundle, and that bundle is installed via OLM. The bundle consists of several YAML files that describe the Operator, its CRD, and its dependencies. OLM knows how to process this bundle in its standardized format to properly manage the Operator in a cluster.

Compiling an Operator's code and deploying it can be done with commands such as the ones shown next. The first command shown in the following code snippet builds the bundle of YAML manifests that describe the Operator. Then, it passes that information to OLM to run the Operator in your cluster:

$ make bundle ...
$ operator-sdk run bundle ...

Later chapters will demonstrate exactly how to use these commands and what they do, but the general idea is that these commands first compile the Operator's Go code into an image and a deployable format that's understandable by OLM. But OLM isn't the only part of the Operator Framework that consumes an Operator's bundle—much of the same information is used by OperatorHub to provide information on an Operator.

Once an Operator has been compiled into its image, OperatorHub exists as a platform to share and distribute those images to other users.

You have been reading a chapter from
The Kubernetes Operator Framework Book
Published in: Jul 2022
Publisher: Packt
ISBN-13: 9781803232850
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image