- Operators are custom controllers...more exactly: A operator is a set of CRDs and a a set of controllers.
- Controllers are the core of Kubernetes, and of any operator.
- The OLM (Operator Lifecycle Manager) helps users install, update, and manage operators in the cluster.
K8S operator that aggregates logs from all pods with label defined in the target
field of LogDrain
object
Create some targets:
# spin up some naked pods
kubectl run pod1 --image=nginx:stable-perl --port=80 --labels='target=kcd'
kubectl run pod3 --image=dejanualex/python_hello:1.0 --labels='target=kcd'
# create .venv virtual environment
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
- Docker operator image:
docker pull dejanualex/literate-operator:1.26
# Apply crds :
kubectl apply -f k8s
# Check resources:
kubectl api-resources | grep dev
# Explain objects
kubectl get ld
kubectl explain logdrain
-
Framework for building Operators… Kubebuilder is a good option since Operator SDK uses Kubebuilder under the hood.
-
The registry for K8S operators OperatorHub.io