dejanu / literate-operator

K8S operator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A word about operators

  • 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.

literate-operator

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'

Local setup

# 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

Steps

# Apply crds : 
kubectl apply -f k8s
# Check resources: 
kubectl api-resources | grep dev
# Explain objects
kubectl get ld
kubectl explain logdrain

Sources

About

K8S operator

License:MIT License


Languages

Language:Python 58.3%Language:Makefile 27.3%Language:Shell 10.6%Language:Dockerfile 3.8%