How does one list all the resourceVersion of a kubernetes object?

12/6/2018

How does one list all the resourceVersion of a Kubernetes object?

For instance, I want to retrieve all the resourceVersions of a configmap from the past. If this is possible I would like to watch all the changes from the past resourceVersion(s) of the configmap (this is my workaround, which I would like to try). Because currently, K8s does not support rollback of ConfigMaps.

Here is the ongoing feature request for that:- https://github.com/kubernetes/kubernetes/issues/22368

-- Suhas Chikkanna
kubectl
kubernetes

1 Answer

12/6/2018

How does one list all the resourceVersion of a Kubernetes object?

Not supported by the API side yet as of this writing. (Also, as described in the issue) Also, deleted objects can be kept in etcd for the value of --auto-compaction-retention, I suppose you can change that value if you want to keep the objects longer and query etcd with etdctl.

Another sort of brute force option is to back up etcd and then restore it on some other node, then manually query etcd for that particular snapshot.

For example to get the kube-proxy ConfigMap:

$ etcdctl --endpoints=https://:2379 get "/registry/configmaps/kube-system/kube-proxy" --cert=client.crt --key=client.key --cacert=ca.crt

These are some other backup tools:

As you mentioned, there's a feature request for historical versions.

-- Rico
Source: StackOverflow