How to restore kubernetes cluster using kops?

2019-03-02 18:36发布

问题:

How do I restore kubernetes cluster using kops? I've kubernetes state files in my s3 bucket.

Is there a way to restore kubernetes cluster using kops?

回答1:

As you mention, kops stores the state of the cluster in an S3 bucket. If you run kops create cluster with the same state file, it will recreate the cluster as it was before, with the same instancegroups and master configuration. This assumes the cluster has been deleted, if not, you'll need to use the kops update cluster command which should bring the state back to your desired once if the state of the cluster has diverged.

However, this doesn't cover the resources and deployments inside the cluster, and to achieve a full recovery, you may want to recover those deployments. In order to achieve this, you'll need to backup the etcd datastore used by Kubernetes. This document covers this in more detail.

You may also want to consider using something like Heptio Ark for backing up the etcd state