kubernetes operator - ghdrako/doc_snipets GitHub Wiki
- https://kubernetes.io/docs/concepts/extend-kubernetes/operator/
- https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/
- https://sdk.operatorframework.io/
- https://github.com/kubernetes-sigs/kubebuilder
- https://metalbear.co/blog/writing-a-kubernetes-operator/
A Kubernetes operator is a pattern of packaging, deploying, and managing a Kubernetes application. It extends the functionality of Kubernetes API. It’s an application-specific controller that extends the functionality of the Kubernetes API to create, configure, and manage instances of complex applications on behalf of a Kubernetes user. It’s a composition of basic Kubernetes resources and controller, also includes domain or application-specific knowledge to automate the entire life cycle of the application it manages. It extends K8s cluster behavior without modifying the K8s configuration code.
It uses custom Kubernetes resources, which is called customer resource definition (CRD). The Kubernetes operator continuously monitors the current state of the K8s cluster using K8s API and matches with the desired state which is defined in CRD. It helps to scale microservices apps, recover K8s clusters if any of its resources go down, and also upgrades applications. There are other major benefits of using operators such as on-demand application deployment, backup/retrieval, upgrade database schemas or extra configuration, simulating failure of K8s cluster, and so on.
It can be deployed as CRD with its controller on the K8s cluster similar to any application deployment on the K8s cluster. The controller runs outside of the control plane.
There are many web portals available from where we can download and use pre-built operators for common purposes. We can also create our custom CRD-based operator using various tools such as Kubebuilder, KUDO, Metacontroller, Operator framework, and so on.
Many existing database products use operators to accomplish this, and more are currently in development (see the Data on Kubernetes community for more information on these efforts).