How does k8s keeps track of all past revisions?

Curiosity topic here :slight_smile:

Reading the Efficient detection of changes section, I was wondering how k8s can keep track of all past resource’s versions/changes.

Docs says:
These changes itemize the outcome of operations (such as create, delete, and update) that occurred after the resourceVersion you specified as a parameter to the watch request.

Meaning that k8s knows the full resource version at any time in the past.

Did k8s save a full snapshot after any received PUT/PATCH request? Maybe a diff?

If anybody knows the magic behind this, or the actual source file inside the repo that does that, thank you much!

Not to be too general, but it is stored within the etcd database for the cluster.

As an example you can see the details with kubectl rollout history deployments - feel free to add kube-system or another namespace with any deployments. Hope that helps

1 Like