如何列出 kubernetes 对象的所有 resourceVersion ?

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

如何列出一个 Kubernetes 对象的所有 resourceVersion?

例如,我想从过去检索一个configmap 的所有resourceVersions。如果可能的话,我想查看 configmap 的过去 resourceVersion(s) 的所有更改(这是我的解决方法,我想尝试一下)。因为目前K8s不支持ConfigMaps的回滚

这是正在进行的功能请求:- https://github.com/kubernetes/kubernetes/issues/22368

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

在撰写本文时,API 方面尚不支持。 (另外,如问题中所述)此外,删除的对象可以保留在 etcd 中,值为 --auto-compaction-retention,我想如果你想保留对象更长的时间并使用 [=11 查询 etcd,我想你可以更改该值=].

另一种暴力选择是 back up etcd and then restore 它在其他节点上,然后手动查询 etcd 以获取该特定快照。

例如获取kube-proxy ConfigMap:

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

这些是其他一些备份工具:

如您所述,有历史版本的功能请求。