+ +
+ ++ + + + + + + + + + + + + + + + + + +
+ +`etcd-druid` is an [etcd](https://github.com/etcd-io/etcd) [operator](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/) which makes it easy to configure, provision, reconcile, monitor and delete etcd clusters. It enables management of etcd clusters through [declarative Kubernetes API model](config/crd/bases/crd-druid.gardener.cloud_etcds.yaml). + +In every etcd cluster managed by `etcd-druid`, each etcd member is a two container `Pod` which consists of: + +- [etcd-wrapper](https://github.com/gardener/etcd-wrapper) which manages the lifecycle (validation & initialization) of an etcd. +- [etcd-backup-restore](https://github.com/gardener/etcd-backup-restore) sidecar which currently provides the following capabilities (the list is not comprehensive): + - [etcd](https://github.com/etcd-io/etcd) DB validation. + - Scheduled [etcd](https://github.com/etcd-io/etcd) DB defragmentation. + - Backup - [etcd](https://github.com/etcd-io/etcd) DB snapshots are taken regularly and backed in an object store if one is configured. + - Restoration - In case of a DB corruption for a single-member cluster it helps in restoring from latest set of snapshots (full & delta). + - Member control operations. + +`etcd-druid` additional provides the following capabilities: + +- Facilitates declarative scale-out of [etcd](https://github.com/etcd-io/etcd) clusters. +- Provides protection against accidental deletion/mutation of resources provisioned as part of an etcd cluster. +- Offers an asynchronous and threshold based capability to process backed up snapshots to: + - Potentially minimize the recovery time by leveraging restoration from backups followed by [etcd's compaction and defragmentation](https://etcd.io/docs/v3.4/op-guide/maintenance/). + - Indirectly assert integrity of the backed up snaphots. +- Allows seamless copy of backups between any two object store buckets. + +## Start using or developing `etcd-druid` locally + +If you are looking to try out druid then you can use a [Kind](https://kind.sigs.k8s.io/) cluster based setup. + + + +For detailed documentation, see our `/docs` folder. Please find the [index](docs/README.md) here. + +## Contributions + +If you wish to contribute then please see our [contributor guidelines](docs/development/contribution.md). + +## Feedback and Support + +We always look forward to active community engagement. Please report bugs or suggestions on how we can enhance `etcd-druid` on [GitHub Issues](https://github.com/gardener/etcd-druid/issues). + +## License + +Release under [Apache-2.0](https://github.com/gardener/etcd-druid/blob/master/LICENSE) license. diff --git a/docs/proposals/00-template.md b/docs/proposals/00-template.md index cde850c51..5ba0e6069 100644 --- a/docs/proposals/00-template.md +++ b/docs/proposals/00-template.md @@ -13,15 +13,6 @@ reviewers: # DEP-NN: Your short, descriptive title -## Table of Contents - -- [Summary](#summary) -- [Motivation](#motivation) - - [Goals](#goals) - - [Non-Goals](#non-goals) -- [Proposal](#proposal) -- [Alternatives](#alternatives) - ## Summary ## Motivation diff --git a/docs/proposals/01-multi-node-etcd-clusters.md b/docs/proposals/01-multi-node-etcd-clusters.md index 0f806e27f..63c6350d3 100644 --- a/docs/proposals/01-multi-node-etcd-clusters.md +++ b/docs/proposals/01-multi-node-etcd-clusters.md @@ -1,149 +1,7 @@ -# Multi-node etcd cluster instances via etcd-druid +# DEP-01: Multi-node etcd cluster instances via etcd-druid This document proposes an approach (along with some alternatives) to support provisioning and management of multi-node etcd cluster instances via [etcd-druid](https://github.com/gardener/etcd-druid) and [etcd-backup-restore](https://github.com/gardener/etcd-backup-restore). -## Content - -- [Multi-node etcd cluster instances via etcd-druid](#multi-node-etcd-cluster-instances-via-etcd-druid) - - [Content](#content) - - [Goal](#goal) - - [Background and Motivation](#background-and-motivation) - - [Single-node etcd cluster](#single-node-etcd-cluster) - - [Multi-node etcd-cluster](#multi-node-etcd-cluster) - - [Dynamic multi-node etcd cluster](#dynamic-multi-node-etcd-cluster) - - [Prior Art](#prior-art) - - [ETCD Operator from CoreOS](#etcd-operator-from-coreos) - - [etcdadm from kubernetes-sigs](#etcdadm-from-kubernetes-sigs) - - [Etcd Cluster Operator from Improbable-Engineering](#etcd-cluster-operator-from-improbable-engineering) - - [General Approach to ETCD Cluster Management](#general-approach-to-etcd-cluster-management) - - [Bootstrapping](#bootstrapping) - - [Assumptions](#assumptions) - - [Adding a new member to an etcd cluster](#adding-a-new-member-to-an-etcd-cluster) - - [Note](#note) - - [Alternative](#alternative) - - [Managing Failures](#managing-failures) - - [Removing an existing member from an etcd cluster](#removing-an-existing-member-from-an-etcd-cluster) - - [Restarting an existing member of an etcd cluster](#restarting-an-existing-member-of-an-etcd-cluster) - - [Recovering an etcd cluster from failure of majority of members](#recovering-an-etcd-cluster-from-failure-of-majority-of-members) - - [Kubernetes Context](#kubernetes-context) - - [Alternative](#alternative-1) - - [ETCD Configuration](#etcd-configuration) - - [Alternative](#alternative-2) - - [Data Persistence](#data-persistence) - - [Persistent](#persistent) - - [Ephemeral](#ephemeral) - - [Disk](#disk) - - [In-memory](#in-memory) - - [How to detect if valid metadata exists in an etcd member](#how-to-detect-if-valid-metadata-exists-in-an-etcd-member) - - [Recommendation](#recommendation) - - [How to detect if valid data exists in an etcd member](#how-to-detect-if-valid-data-exists-in-an-etcd-member) - - [Recommendation](#recommendation-1) - - [Separating peer and client traffic](#separating-peer-and-client-traffic) - - [Cutting off client requests](#cutting-off-client-requests) - - [Manipulating Client Service podSelector](#manipulating-client-service-podselector) - - [Health Check](#health-check) - - [Backup Failure](#backup-failure) - - [Alternative](#alternative-3) - - [Status](#status) - - [Members](#members) - - [Note](#note-1) - - [Member name as the key](#member-name-as-the-key) - - [Member Leases](#member-leases) - - [Conditions](#conditions) - - [ClusterSize](#clustersize) - - [Alternative](#alternative-4) - - [Decision table for etcd-druid based on the status](#decision-table-for-etcd-druid-based-on-the-status) - - [1. Pink of health](#1-pink-of-health) - - [Observed state](#observed-state) - - [Recommended Action](#recommended-action) - - [2. Member status is out of sync with their leases](#2-member-status-is-out-of-sync-with-their-leases) - - [Observed state](#observed-state-1) - - [Recommended Action](#recommended-action-1) - - [3. All members are `Ready` but `AllMembersReady` condition is stale](#3-all-members-are-ready-but-allmembersready-condition-is-stale) - - [Observed state](#observed-state-2) - - [Recommended Action](#recommended-action-2) - - [4. Not all members are `Ready` but `AllMembersReady` condition is stale](#4-not-all-members-are-ready-but-allmembersready-condition-is-stale) - - [Observed state](#observed-state-3) - - [Recommended Action](#recommended-action-3) - - [5. Majority members are `Ready` but `Ready` condition is stale](#5-majority-members-are-ready-but-ready-condition-is-stale) - - [Observed state](#observed-state-4) - - [Recommended Action](#recommended-action-4) - - [6. Majority members are `NotReady` but `Ready` condition is stale](#6-majority-members-are-notready-but-ready-condition-is-stale) - - [Observed state](#observed-state-5) - - [Recommended Action](#recommended-action-5) - - [7. Some members have been in `Unknown` status for a while](#7-some-members-have-been-in-unknown-status-for-a-while) - - [Observed state](#observed-state-6) - - [Recommended Action](#recommended-action-6) - - [8. Some member pods are not `Ready` but have not had the chance to update their status](#8-some-member-pods-are-not-ready-but-have-not-had-the-chance-to-update-their-status) - - [Observed state](#observed-state-7) - - [Recommended Action](#recommended-action-7) - - [9. Quorate cluster with a minority of members `NotReady`](#9-quorate-cluster-with-a-minority-of-members-notready) - - [Observed state](#observed-state-8) - - [Recommended Action](#recommended-action-8) - - [10. Quorum lost with a majority of members `NotReady`](#10-quorum-lost-with-a-majority-of-members-notready) - - [Observed state](#observed-state-9) - - [Recommended Action](#recommended-action-9) - - [11. Scale up of a healthy cluster](#11-scale-up-of-a-healthy-cluster) - - [Observed state](#observed-state-10) - - [Recommended Action](#recommended-action-10) - - [12. Scale down of a healthy cluster](#12-scale-down-of-a-healthy-cluster) - - [Observed state](#observed-state-11) - - [Recommended Action](#recommended-action-11) - - [13. Superfluous member entries in `Etcd` status](#13-superfluous-member-entries-in-etcd-status) - - [Observed state](#observed-state-12) - - [Recommended Action](#recommended-action-12) - - [Decision table for etcd-backup-restore during initialization](#decision-table-for-etcd-backup-restore-during-initialization) - - [1. First member during bootstrap of a fresh etcd cluster](#1-first-member-during-bootstrap-of-a-fresh-etcd-cluster) - - [Observed state](#observed-state-13) - - [Recommended Action](#recommended-action-13) - - [2. Addition of a new following member during bootstrap of a fresh etcd cluster](#2-addition-of-a-new-following-member-during-bootstrap-of-a-fresh-etcd-cluster) - - [Observed state](#observed-state-14) - - [Recommended Action](#recommended-action-14) - - [3. Restart of an existing member of a quorate cluster with valid metadata and data](#3-restart-of-an-existing-member-of-a-quorate-cluster-with-valid-metadata-and-data) - - [Observed state](#observed-state-15) - - [Recommended Action](#recommended-action-15) - - [4. Restart of an existing member of a quorate cluster with valid metadata but without valid data](#4-restart-of-an-existing-member-of-a-quorate-cluster-with-valid-metadata-but-without-valid-data) - - [Observed state](#observed-state-16) - - [Recommended Action](#recommended-action-16) - - [5. Restart of an existing member of a quorate cluster without valid metadata](#5-restart-of-an-existing-member-of-a-quorate-cluster-without-valid-metadata) - - [Observed state](#observed-state-17) - - [Recommended Action](#recommended-action-17) - - [6. Restart of an existing member of a non-quorate cluster with valid metadata and data](#6-restart-of-an-existing-member-of-a-non-quorate-cluster-with-valid-metadata-and-data) - - [Observed state](#observed-state-18) - - [Recommended Action](#recommended-action-18) - - [7. Restart of the first member of a non-quorate cluster without valid data](#7-restart-of-the-first-member-of-a-non-quorate-cluster-without-valid-data) - - [Observed state](#observed-state-19) - - [Recommended Action](#recommended-action-19) - - [8. Restart of a following member of a non-quorate cluster without valid data](#8-restart-of-a-following-member-of-a-non-quorate-cluster-without-valid-data) - - [Observed state](#observed-state-20) - - [Recommended Action](#recommended-action-20) - - [Backup](#backup) - - [Leading ETCD main container’s sidecar is the backup leader](#leading-etcd-main-containers-sidecar-is-the-backup-leader) - - [Independent leader election between backup-restore sidecars](#independent-leader-election-between-backup-restore-sidecars) - - [History Compaction](#history-compaction) - - [Defragmentation](#defragmentation) - - [Work-flows in etcd-backup-restore](#work-flows-in-etcd-backup-restore) - - [Work-flows independent of leader election in all members](#work-flows-independent-of-leader-election-in-all-members) - - [Work-flows only on the leading member](#work-flows-only-on-the-leading-member) - - [High Availability](#high-availability) - - [Zonal Cluster - Single Availability Zone](#zonal-cluster---single-availability-zone) - - [Alternative](#alternative-5) - - [Regional Cluster - Multiple Availability Zones](#regional-cluster---multiple-availability-zones) - - [Alternative](#alternative-6) - - [PodDisruptionBudget](#poddisruptionbudget) - - [Rolling updates to etcd members](#rolling-updates-to-etcd-members) - - [Follow Up](#follow-up) - - [Ephemeral Volumes](#ephemeral-volumes) - - [Shoot Control-Plane Migration](#shoot-control-plane-migration) - - [Performance impact of multi-node etcd clusters](#performance-impact-of-multi-node-etcd-clusters) - - [Metrics, Dashboards and Alerts](#metrics-dashboards-and-alerts) - - [Costs](#costs) - - [Future Work](#future-work) - - [Gardener Ring](#gardener-ring) - - [Autonomous Shoot Clusters](#autonomous-shoot-clusters) - - [Optimization of recovery from non-quorate cluster with some member containing valid data](#optimization-of-recovery-from-non-quorate-cluster-with-some-member-containing-valid-data) - - [Optimization of rolling updates to unhealthy etcd clusters](#optimization-of-rolling-updates-to-unhealthy-etcd-clusters) - ## Goal - Enhance etcd-druid and etcd-backup-restore to support provisioning and management of multi-node etcd cluster instances within a single Kubernetes cluster. diff --git a/docs/proposals/02-snapshot-compaction.md b/docs/proposals/02-snapshot-compaction.md index 38494debd..76619a777 100644 --- a/docs/proposals/02-snapshot-compaction.md +++ b/docs/proposals/02-snapshot-compaction.md @@ -1,4 +1,4 @@ -# Snapshot Compaction for Etcd +# DEP-02: Snapshot Compaction for Etcd ## Current Problem To ensure recoverability of Etcd, backups of the database are taken at regular interval. diff --git a/docs/proposals/03-scaling-up-an-etcd-cluster.md b/docs/proposals/03-scaling-up-an-etcd-cluster.md index 998e15108..51af42f94 100644 --- a/docs/proposals/03-scaling-up-an-etcd-cluster.md +++ b/docs/proposals/03-scaling-up-an-etcd-cluster.md @@ -1,4 +1,4 @@ -# Scaling-up a single-node to multi-node etcd cluster deployed by etcd-druid +# DEP-03: Scaling-up a single-node to multi-node etcd cluster deployed by etcd-druid To mark a cluster for scale-up from single node to multi-node etcd, just patch the etcd custom resource's `.spec.replicas` from `1` to `3` (for example). diff --git a/docs/proposals/04-etcd-member-custom-resource.md b/docs/proposals/04-etcd-member-custom-resource.md index 5b9cf6ea2..3a75e9ed2 100644 --- a/docs/proposals/04-etcd-member-custom-resource.md +++ b/docs/proposals/04-etcd-member-custom-resource.md @@ -12,46 +12,6 @@ reviewers: # DEP-04: EtcdMember Custom Resource -## Table of Contents - -* [DEP-04: EtcdMember Custom Resource](#dep-04-etcdmember-custom-resource) - * [Table of Contents](#table-of-contents) - * [Summary](#summary) - * [Terminology](#terminology) - * [Motivation](#motivation) - * [Goals](#goals) - * [Non-Goals](#non-goals) - * [Proposal](#proposal) - * [Etcd Member Metadata](#etcd-member-metadata) - * [Etcd Member State Transitions](#etcd-member-state-transitions) - * [States and Sub-States](#states-and-sub-states) - * [Top Level State Transitions](#top-level-state-transitions) - * [Starting an Etcd-Member in a Single-Node Etcd Cluster](#starting-an-etcd-member-in-a-single-node-etcd-cluster) - * [Addition of a New Etcd-Member in a Multi-Node Etcd Cluster](#addition-of-a-new-etcd-member-in-a-multi-node-etcd-cluster) - * [Restart of a Voting Etcd-Member in a Multi-Node Etcd Cluster](#restart-of-a-voting-etcd-member-in-a-multi-node-etcd-cluster) - * [Deterministic Etcd Member Creation/Restart During Scale-Up](#deterministic-etcd-member-creationrestart-during-scale-up) - * [TLS Enablement for Peer Communication](#tls-enablement-for-peer-communication) - * [Monitoring Backup Health](#monitoring-backup-health) - * [Enhanced Snapshot Compaction](#enhanced-snapshot-compaction) - * [Enhanced Defragmentation](#enhanced-defragmentation) - * [Monitoring Defragmentations](#monitoring-defragmentations) - * [Monitoring Restorations](#monitoring-restorations) - * [Monitoring Volume Mismatches](#monitoring-volume-mismatches) - * [Custom Resource API](#custom-resource-api) - * [Spec vs Status](#spec-vs-status) - * [Representing State Transitions](#representing-state-transitions) - * [Reason Codes](#reason-codes) - * [API](#api) - * [EtcdMember](#etcdmember) - * [Etcd](#etcd) - * [Lifecycle of an EtcdMember](#lifecycle-of-an-etcdmember) - * [Creation](#creation) - * [Updation](#updation) - * [Deletion](#deletion) - * [Reconciliation](#reconciliation) - * [Stale EtcdMember Status Handling](#stale-etcdmember-status-handling) - * [Reference](#reference) - ## Summary Today, [etcd-druid](https://github.com/gardener/etcd-druid) mainly acts as an etcd cluster provisioner, and seldom takes remediatory actions if the [etcd](https://etcd.io/) cluster goes into an undesired state that needs to be resolved by a human operator. In other words, etcd-druid cannot perform day-2 operations on etcd clusters in its current form, and hence cannot carry out its full set of responsibilities as a true "operator" of etcd clusters. For etcd-druid to be fully capable of its responsibilities, it must know the latest state of the etcd clusters and their individual members at all times. diff --git a/docs/proposals/05-etcd-operator-tasks.md b/docs/proposals/05-etcd-operator-tasks.md index 2f82ab54f..232f877ff 100644 --- a/docs/proposals/05-etcd-operator-tasks.md +++ b/docs/proposals/05-etcd-operator-tasks.md @@ -13,46 +13,6 @@ reviewers: # DEP-05: Operator Out-of-band Tasks -## Table of Contents - -- [DEP-05: Operator Out-of-band Tasks](#dep-05-operator-out-of-band-tasks) - - [Table of Contents](#table-of-contents) - - [Summary](#summary) - - [Terminology](#terminology) - - [Motivation](#motivation) - - [Goals](#goals) - - [Non-Goals](#non-goals) - - [Proposal](#proposal) - - [Custom Resource Golang API](#custom-resource-golang-api) - - [Spec](#spec) - - [Status](#status) - - [Custom Resource YAML API](#custom-resource-yaml-api) - - [Lifecycle](#lifecycle) - - [Creation](#creation) - - [Execution](#execution) - - [Deletion](#deletion) - - [Use Cases](#use-cases) - - [Recovery from permanent quorum loss](#recovery-from-permanent-quorum-loss) - - [Task Config](#task-config) - - [Pre-Conditions](#pre-conditions) - - [Trigger on-demand snapshot compaction](#trigger-on-demand-snapshot-compaction) - - [Possible scenarios](#possible-scenarios) - - [Task Config](#task-config-1) - - [Pre-Conditions](#pre-conditions-1) - - [Trigger on-demand full/delta snapshot](#trigger-on-demand-fulldelta-snapshot) - - [Possible scenarios](#possible-scenarios-1) - - [Task Config](#task-config-2) - - [Pre-Conditions](#pre-conditions-2) - - [Trigger on-demand maintenance of etcd cluster](#trigger-on-demand-maintenance-of-etcd-cluster) - - [Possible Scenarios](#possible-scenarios-2) - - [Task Config](#task-config-3) - - [Pre-Conditions](#pre-conditions-3) - - [Copy Backups Task](#copy-backups-task) - - [Possible Scenarios](#possible-scenarios-3) - - [Task Config](#task-config-4) - - [Pre-Conditions](#pre-conditions-4) - - [Metrics](#metrics) - ## Summary This DEP proposes an enhancement to `etcd-druid`'s capabilities to handle [out-of-band](#terminology) tasks, which are presently performed manually or invoked programmatically via suboptimal APIs. The document proposes the establishment of a unified interface by defining a well-structured API to harmonize the initiation of any `out-of-band` task, monitor its status, and simplify the process of adding new tasks and managing their lifecycles. diff --git a/docs/usage/managing-etcd-clusters.md b/docs/usage/managing-etcd-clusters.md index d05e0a60d..f6161d192 100644 --- a/docs/usage/managing-etcd-clusters.md +++ b/docs/usage/managing-etcd-clusters.md @@ -13,24 +13,24 @@ In order to track the progress of creation of etcd cluster resources you can do * `status.lastOperation` can be monitored to check the status of reconciliation. * Additional printer columns have been defined for `Etcd` custom resource. You can execute the following command to know if an `Etcd` cluster is ready/quorate. - ```bash - kubectl get etcd