kops icon indicating copy to clipboard operation
kops copied to clipboard

Document how to restore etcd after a failed master upgrade

Open trondhindenes opened this issue 7 years ago • 13 comments

There's quite a few issues where users have ruined their clusters following a master-upgrade. Many of these simply wipe the cluster and start from scratch. This is not always possible in a prod scenario.

The current backup/restore documentation for etcd-manager is very light, and fails to provide enough info on how to perform a restore when the etcd cluster has "changed" (since a node was likely removed and another added).

I've tried to understand how this all fits together for hours, but i'm simply stuck. We are extremely worried now that we realize we're using kops without being able to perform a restore if something goes wrong with a master - in practice it means we simply can't touch the masters at all.

I would argue that with "native" etcd there's at least some documentation on how to add/remove nodes from a cluster, so that basic disaster recovery is fairly straight-forward. Etcd-manager abstracts away all this, and I would therefore argue that it's extremely important to document the options one has to manage the etcd cluster "thru" etcd-manager.

I would be happy to submit a PR with enhanced documentation, but I'm simply not able to figure this out.

trondhindenes avatar Aug 08 '19 20:08 trondhindenes

Thanks @trondhindenes for raising this issue. We are facing the same situation. Our clusters are stilling running Kops/kubernetes 1.10 version because we don't have a proper rollback strategy for upgrade of masters. Our Etcd databases are also running as 2.x in the production. Even we tested to upgrade them to 3.x successfully in other environments multiple times. We are still afraid to do that in production without a detailed document of how to restore them properly.

Thanks in advance for anyone who can share their knowledge or submit a PR with enhanced documentation.

wohckcin avatar Aug 12 '19 01:08 wohckcin

@nickychow I ended up writing this, but I don't know if it works for you. https://t.co/HE0SnoGfZH

trondhindenes avatar Aug 12 '19 10:08 trondhindenes

We're in almost the same situation as you @trondhindenes, trying to upgrade from 1.10.13 with kops 1.12.2 we have the cluster with three master nodes, but one of them is out of the etcd "ring" and we are not able to recover from this bad scenario

jjuarez avatar Aug 22 '19 13:08 jjuarez

Thanks for the documentation @trondhindenes you made my day with this small guide, my master are back thanks to this blog post

jjuarez avatar Aug 22 '19 17:08 jjuarez

@trondhindenes Thanks heaps for your great work. That's definitely going to help a lot.

wohckcin avatar Aug 23 '19 01:08 wohckcin

@jjuarez I've made a small addition to the blog post detailing how to remove some stale etcd records which will corrupt the kubernetes service if left unchecked. I'm pretty sure that was added after you saw the guide, so feel free to revisit. It's at the very end of the blog post.

trondhindenes avatar Sep 03 '19 19:09 trondhindenes

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar Dec 02 '19 19:12 fejta-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten

fejta-bot avatar Jan 01 '20 20:01 fejta-bot

for those want the updated url: https://www.hindenes.com/#/post/49956e54-04a7-45b7-84ea-fd6c2cbb4e15

guikcd avatar Jan 22 '20 22:01 guikcd

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

fejta-bot avatar Feb 21 '20 23:02 fejta-bot

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Feb 21 '20 23:02 k8s-ci-robot

correct url for the post is: https://hindenes.com/2019-08-09-kops-restore

trondhindenes avatar May 17 '20 15:05 trondhindenes

For those who are using nginx-ingress controller and getting a 404 error for sites exposed through ingress after restoring etcd backup, follow below additional steps after etcd restore.

  • Restart kube-apiserver pod
  • Restart kubelet service on all nodes
  • Restart nginx ingress controller pods

kulkarniijayesh avatar Sep 15 '20 09:09 kulkarniijayesh