/limitednamespace-operator

A sample Kubernetes operator written with kopf

Primary LanguagePython

LimitedNamespace Kubernetes Operator

This is a small Kubernetes operator written with kopf.
It is for educational purposes only and probably has many bugs in it. Use it to learn and discover how easy it can be to write a Kubernetes operator.

It uses the LimitedNamespace CR with crd.yaml that creates a namespace that is auto-deleted after a specified time.

How to run locally

  1. Make sure you have access to a Kubernetes cluster
  2. Install python modules (pip install -r requirements.txt)
  3. Install crd (kubectl apply -f crd.yaml)
  4. Run the following command:
kopf run lns.py --verbose

How to run on a custer

  1. Install crd (kubectl apply -f crd.yaml)
  2. Use skaffold to build a container image and deploy the operator using manifests from k8s/base
skaffold run

Creating LimitedNamespace CR objects

Create a Custom Resource using one of the files in the examples/ directory.