Kubernetes - Operators
What are Operators?
Why called "operators"? The goal of an Operator is to put operational knowledge into software, i.e. to automate manual work (deploy, restart, upgrade, etc) of human operator / administrator.
Operators = Kubernetes native applications = Business Logic + Automated Operations = Custom Resources + Custom Controllers
Layers of Abstractions
- Golang provides a generic
RESTClienton top of
http.Client(Generic HTTP + REST).
client-gois used by k8s clients to talk to API Server. E.g. used by
Client(built on top of
RESTClient) that knows how to perform CRUD operations on Kubernetes objects.
- kubebuilder: built on top of
controller-runtimeand make it easier to build k8s API.
- Operator-SDK: uses Kubebuilder as a library; uses the plugin feature to include non-Go operators e.g. operator-sdk's Ansible and Helm-based language Operators.
- Operator-SDK is part of Operator Framework, by redhat. (SDK for development, lifecycle manager after deployment, a public catalog to share Operators like Docker Hub)
kubebuilder is a framework for building Kubernetes APIs using CRDs, Controllers and Admission Webhooks; (use comment in go code like
// +kubebuilder:xxx to auto generate code) is built on top of controller-runtime
//+kubebuilder:object:root=true is a marker used by https://github.com/kubernetes-sigs/controller-tools to generate CRM manifests from go code.