Would it be hard to recover some components of k8s cluster if they were accidentally deleted?

I find it useful to have history of changes and backup of all resources. It already saved me some hours but feeling of safety is more important.

I made the kube-backup (https://github.com/kuberhost/kube-backup). It does few simple steps:

Runs periodically with CronJob

Execute kubectl get ... for each resource type

for each resource type Remove unnecessary fields

Save each object in as a file e.g. kube-system/Deployment/metrics-server.yaml

Do git commit

Push changes to repository

There is no functionality to automatically recover, but we can clone repository and do kubectl apply … for objects we want to restore

Commit messages are somehow meaningful and provide nice history of changes.

I would love to hear your thoughts about this