Skip to content

Latest commit

 

History

History
53 lines (37 loc) · 851 Bytes

README.md

File metadata and controls

53 lines (37 loc) · 851 Bytes

Sample controller for built-in resource

An example of kubernetes controller watching pods.

Start demo cluster with kind, kubeconfig should be available for the controller:

kind create cluster

Start our demo pod controller:

go run .

You should see that some system pods were already catched by the controller:

Pod added: kube-system/etcd-kind-control-plane
...

Let's add another pod:

kubectl apply -f pod.yaml

We should see that controller has handled the event:

Pod added: default/echo
Pod updated: default/echo
...

There is also a bunch of update events caused by the system.

Lets delete the pod:

kubectl delete pod echo

After a couple of updates the pod gets deleted:

...
Pod updated: default/echo
Pod updated: default/echo
Pod deleted: default/echo