Slide 46
Slide 46 text
Watch
❯ kubectl get --raw
'/api/v1/namespaces/default/pods?
watch=1&resourceVersion=1452'
{
"type": "MODIFIED",
"object": {
"kind": "Pod", "apiVersion": "v1",
"metadata": {"resourceVersion":"1650", ...}, ...}
}
...
{
"type": "DELETED",
"object": {
"kind": "Pod", "apiVersion": "v1",
"metadata": {"resourceVersion":"1734", ...}, ...}
}
“Kubernetes is a declarative, event-
driven system.”
● I have my state of the world from LIST. Now I need
to know as and when events happen that modify
this state so that I can take corrective action.
● WATCH for changes. The API Server gives us a
stream of notifications on a single connection that
we can “react” to.