Kubernetes Operators Advanced
This course covers advanced operator topics including reconciliation, use of Operator Lifecycle Manager to deploy and upgrade operators, and use of Scorecard to test operators.
ABOUT THIS COURSE
This course covers Golang operator reconciliation, use of OLM, and use of Scorecard.
Operators mimic the behavior of core Kubernetes components in many ways, chief among them the process of reconciliation. When a user creates an instance of your operator's type, one or more controllers is responsible for creating that desired state. This course covers the creation of a basic reconcile loop in Golang to create a simple Memcached operator, similar to the Golang operator from the Intermediate course.
Operator Lifecycle Manager (OLM)
OLM is a tool for installing and upgrading operators on a Kubernetes cluster. Operator authors create a Bundle for each version of their operator, which is then published and consumed by OLM. This course covers the creation of a bundle for the simple Memcached operator from above, and then covers the upgrade case by adding a new field, implements migration via conversion webhook, creates a new bundle, and upgrades the deployed operator in-place.
Scorecard is an Operator-sdk command for scaffolding and running test frameworks on a deployed operator. This course first covers using Scorecard to automatically generate and run a basic verification test suite. Then, it shows how to create your own custom test suite with a non-trivial unit test for the above simple Memcached operator.
In this course you will learn about:
- How reconciliation logic works in Kubernetes controllers
- Constructing your own reconcile loop in a Golang operator
- Getting an introduction to the Operator Lifecycle Manager (OLM)
- Deploying and managing an operator using OLM
- Using Scorecard to create a test suite for your operator
Module 1 - Golang Operator Reconciliation
- Overview of Kubernetes controller reconciliation
- Kubernetes' declarative API
- Explanation of Memcached operator reconciliation via finite state diagram
- Hands-on Lab
- Build a simple Golang operator with Operator SDK
- Write reconciliation loop using controller-runtime library
Module 2 - Overview of Operator Lifecycle Manager (OLM)
- What is OLM?
- What is an operator bundle
- Hands-on Lab 1
- Install OLM on your cluster
- Package a Golang operator with OLM
- Deploy it to the cluster using OLM
- Hands-on Lab 2
- Update operator with a breaking change
- Create a conversion webhook to manage the upgrade
- Use OLM to upgrade operator in-place
Module 3 - Testing your operator with Scorecard
- Overview of Scorecard, an Operator SDK tool for building test images for a deployed operator
- Hands-on Lab
- Build an Ansible operator with Operator-sdk
- Write an integration test for Memcached operator
Basic familiarity with Kubernetes, including using kubectl to create resources on a Kubernetes cluster. You should know how to create, update, and delete Kubernetes resources such as Pods and Services.Understanding of the basic construction, deployment, and use of operators Completion of the Intermediate course on Kubernetes operators
The labs in this course cover the creation, deployment, and use of operators on a Kubernetes cluster. It assumes you are already familiar with the basics of Kubernetes, such as using kubectl to create resources on a Kubernetes cluster.
The requirements for the hands-on labs are as follows:
- Requirements for all hands-on labs
- Operator SDK v1.5.0+ installed
- Kubectl v1.17.0+ installed
- Admin access to a Kubernetes cluster. Note that the version of Operator Lifecycle Manger currently(8/23/21) on IMB Cloud's Kubernetes Service is incompatible with this tutorial. For running a cluster locally, see the Minikube docs.
- Docker v3.2.2+ installed
- Access to a Docker image repository such as Docker Hub or quay.io
- Golang v1.16.0+ installed
- No additional requirements
- Operator Lifecycle Manager installed on your Kubernetes cluster. The Operator-sdk command operator-sdk olm install will install a compatible version of OLM on your cluster. Note that currently(8/23/21) the version of OLM installed on IBM Cloud IKS clusters is incompatible with this tutorial.
- No additional requirements
Jonathan Berkhahn is an open source software contributor for IBM. He’s worked on various OSS cloud computing projects such as Cloud Foundry and Kubernetes and currently contributes to Operator-sdk and related projects.