The following can be backed up:
If all the k8s resources are created using config files (declarative approach), then the configuration directory can be backed up using a version control system like Git. If all the resources are not created this way, we can generate resource configuration by running kubectl get all --all-namespaces -o yaml > all.yaml
.
Recommended to use Velero, a managed tool that can take backups of the cluster configuration.
ETCD cluster can be backed up instead of generating the resource configuration for the cluster. For this, backup the data directory of the ETCD cluster.
In managed k8s engine, ETCD data directory is not accessible. In such cases, backup the resource configuration.
velero install
command along with the storage plugin and credentials to create the Velero pod looking for backups in the storage destination.