{"id":13451687,"url":"https://github.com/coreos/etcd-operator","last_synced_at":"2025-09-28T19:31:52.272Z","repository":{"id":40321235,"uuid":"64974719","full_name":"coreos/etcd-operator","owner":"coreos","description":"etcd operator creates/configures/manages etcd clusters atop Kubernetes","archived":true,"fork":false,"pushed_at":"2020-04-03T03:49:52.000Z","size":3315,"stargazers_count":1745,"open_issues_count":199,"forks_count":742,"subscribers_count":73,"default_branch":"master","last_synced_at":"2024-05-22T13:33:29.042Z","etag":null,"topics":["etcd","kubernetes","operator"],"latest_commit_sha":null,"homepage":"https://coreos.com/blog/introducing-the-etcd-operator.html","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coreos.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"code-of-conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-08-04T23:54:58.000Z","updated_at":"2024-05-16T10:01:05.000Z","dependencies_parsed_at":"2022-08-02T12:30:55.898Z","dependency_job_id":null,"html_url":"https://github.com/coreos/etcd-operator","commit_stats":null,"previous_names":["coreos/kube-etcd-controller"],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fetcd-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fetcd-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fetcd-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coreos%2Fetcd-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coreos","download_url":"https://codeload.github.com/coreos/etcd-operator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234555879,"owners_count":18851864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["etcd","kubernetes","operator"],"created_at":"2024-07-31T07:00:59.236Z","updated_at":"2025-09-28T19:31:46.910Z","avatar_url":"https://github.com/coreos.png","language":"Go","readme":"# etcd operator\n\n### Project status: archived\n\nThis project is no longer actively developed or maintained. The project exists here for historical reference. If you are interested in the future of the project and taking over stewardship, please contact etcd-dev@googlegroups.com.\n\n### Overview\n\nThe etcd operator manages etcd clusters deployed to [Kubernetes][k8s-home] and automates tasks related to operating an etcd cluster.\n\n- [Create and Destroy](#create-and-destroy-an-etcd-cluster)\n- [Resize](#resize-an-etcd-cluster)\n- [Failover](#failover)\n- [Rolling upgrade](#upgrade-an-etcd-cluster)\n- [Backup and Restore](#backup-and-restore-an-etcd-cluster)\n\nThere are [more spec examples](./doc/user/spec_examples.md) on setting up clusters with different configurations\n\nRead [Best Practices](./doc/best_practices.md) for more information on how to better use etcd operator.\n\nRead [RBAC docs](./doc/user/rbac.md) for how to setup RBAC rules for etcd operator if RBAC is in place.\n\nRead [Developer Guide](./doc/dev/developer_guide.md) for setting up a development environment if you want to contribute.\n\nSee the [Resources and Labels](./doc/user/resource_labels.md) doc for an overview of the resources created by the etcd-operator.\n\n## Requirements\n\n- Kubernetes 1.8+\n- etcd 3.2.13+\n\n## Demo\n\n## Getting started\n\n![etcd Operator demo](https://raw.githubusercontent.com/coreos/etcd-operator/master/doc/gif/demo.gif)\n\n### Deploy etcd operator\n\nSee [instructions on how to install/uninstall etcd operator](doc/user/install_guide.md) .\n\n### Create and destroy an etcd cluster\n\n```bash\n$ kubectl create -f example/example-etcd-cluster.yaml\n```\n\nA 3 member etcd cluster will be created.\n\n```bash\n$ kubectl get pods\nNAME                            READY     STATUS    RESTARTS   AGE\nexample-etcd-cluster-gxkmr9ql7z   1/1       Running   0          1m\nexample-etcd-cluster-m6g62x6mwc   1/1       Running   0          1m\nexample-etcd-cluster-rqk62l46kw   1/1       Running   0          1m\n```\n\nSee [client service](doc/user/client_service.md) for how to access etcd clusters created by the operator.\n\nIf you are working with [minikube locally](https://github.com/kubernetes/minikube#minikube), create a nodePort service and test that etcd is responding:\n\n```bash\n$ kubectl create -f example/example-etcd-cluster-nodeport-service.json\n$ export ETCDCTL_API=3\n$ export ETCDCTL_ENDPOINTS=$(minikube service example-etcd-cluster-client-service --url)\n$ etcdctl put foo bar\n```\n\nDestroy the etcd cluster:\n\n```bash\n$ kubectl delete -f example/example-etcd-cluster.yaml\n```\n\n### Resize an etcd cluster\n\nCreate an etcd cluster:\n\n```\n$ kubectl apply -f example/example-etcd-cluster.yaml\n```\n\nIn `example/example-etcd-cluster.yaml` the initial cluster size is 3.\nModify the file and change `size` from 3 to 5.\n\n```\n$ cat example/example-etcd-cluster.yaml\napiVersion: \"etcd.database.coreos.com/v1beta2\"\nkind: \"EtcdCluster\"\nmetadata:\n  name: \"example-etcd-cluster\"\nspec:\n  size: 5\n  version: \"3.2.13\"\n```\n\nApply the size change to the cluster CR:\n```\n$ kubectl apply -f example/example-etcd-cluster.yaml\n```\nThe etcd cluster will scale to 5 members (5 pods):\n```\n$ kubectl get pods\nNAME                            READY     STATUS    RESTARTS   AGE\nexample-etcd-cluster-cl2gpqsmsw   1/1       Running   0          5m\nexample-etcd-cluster-cx2t6v8w78   1/1       Running   0          5m\nexample-etcd-cluster-gxkmr9ql7z   1/1       Running   0          7m\nexample-etcd-cluster-m6g62x6mwc   1/1       Running   0          7m\nexample-etcd-cluster-rqk62l46kw   1/1       Running   0          7m\n```\n\nSimilarly we can decrease the size of the cluster from 5 back to 3 by changing the size field again and reapplying the change.\n\n```\n$ cat example/example-etcd-cluster.yaml\napiVersion: \"etcd.database.coreos.com/v1beta2\"\nkind: \"EtcdCluster\"\nmetadata:\n  name: \"example-etcd-cluster\"\nspec:\n  size: 3\n  version: \"3.2.13\"\n```\n```\n$ kubectl apply -f example/example-etcd-cluster.yaml\n```\n\nWe should see that etcd cluster will eventually reduce to 3 pods:\n\n```\n$ kubectl get pods\nNAME                            READY     STATUS    RESTARTS   AGE\nexample-etcd-cluster-cl2gpqsmsw   1/1       Running   0          6m\nexample-etcd-cluster-gxkmr9ql7z   1/1       Running   0          8m\nexample-etcd-cluster-rqk62l46kw   1/1       Running   0          9mp\n```\n\n### Failover\n\nIf the minority of etcd members crash, the etcd operator will automatically recover the failure.\nLet's walk through this in the following steps.\n\nCreate an etcd cluster:\n\n```\n$ kubectl create -f example/example-etcd-cluster.yaml\n```\n\nWait until all three members are up. Simulate a member failure by deleting a pod:\n\n```bash\n$ kubectl delete pod example-etcd-cluster-cl2gpqsmsw --now\n```\n\nThe etcd operator will recover the failure by creating a new pod `example-etcd-cluster-n4h66wtjrg`:\n\n```bash\n$ kubectl get pods\nNAME                            READY     STATUS    RESTARTS   AGE\nexample-etcd-cluster-gxkmr9ql7z   1/1       Running   0          10m\nexample-etcd-cluster-n4h66wtjrg   1/1       Running   0          26s\nexample-etcd-cluster-rqk62l46kw   1/1       Running   0          10m\n```\n\nDestroy etcd cluster:\n```bash\n$ kubectl delete -f example/example-etcd-cluster.yaml\n```\n\n### etcd operator recovery\n\nLet's walk through operator recovery in the following steps.\n\nCreate an etcd cluster:\n\n```\n$ kubectl create -f example/example-etcd-cluster.yaml\n```\n\nWait until all three members are up. Then stop the etcd operator and delete one of the etcd pods:\n\n```bash\n$ kubectl delete -f example/deployment.yaml\ndeployment \"etcd-operator\" deleted\n\n$ kubectl delete pod example-etcd-cluster-8gttjl679c --now\npod \"example-etcd-cluster-8gttjl679c\" deleted\n```\n\nNext restart the etcd operator. It should recover itself and the etcd clusters it manages.\n\n```bash\n$ kubectl create -f example/deployment.yaml\ndeployment \"etcd-operator\" created\n\n$ kubectl get pods\nNAME                              READY     STATUS    RESTARTS   AGE\nexample-etcd-cluster-m8gk76l4ns   1/1       Running   0          3m\nexample-etcd-cluster-q6mff85hml   1/1       Running   0          3m\nexample-etcd-cluster-xnfvm7lg66   1/1       Running   0          11s\n```\n\n### Upgrade an etcd cluster\n\nCreate and have the following yaml file ready:\n\n```\n$ cat upgrade-example.yaml\napiVersion: \"etcd.database.coreos.com/v1beta2\"\nkind: \"EtcdCluster\"\nmetadata:\n  name: \"example-etcd-cluster\"\nspec:\n  size: 3\n  version: \"3.1.10\"\n  repository: \"quay.io/coreos/etcd\"\n```\n\nCreate an etcd cluster with the version specified (3.1.10) in the yaml file:\n\n```\n$ kubectl apply -f upgrade-example.yaml\n$ kubectl get pods\nNAME                              READY     STATUS    RESTARTS   AGE\nexample-etcd-cluster-795649v9kq   1/1       Running   1          3m\nexample-etcd-cluster-jtp447ggnq   1/1       Running   1          4m\nexample-etcd-cluster-psw7sf2hhr   1/1       Running   1          4m\n```\n\nThe container image version should be 3.1.10:\n\n```\n$ kubectl get pod example-etcd-cluster-795649v9kq -o yaml | grep \"image:\" | uniq\n    image: quay.io/coreos/etcd:v3.1.10\n```\n\nNow modify the file `upgrade-example` and change the `version` from 3.1.10 to 3.2.13:\n\n```\n$ cat upgrade-example\napiVersion: \"etcd.database.coreos.com/v1beta2\"\nkind: \"EtcdCluster\"\nmetadata:\n  name: \"example-etcd-cluster\"\nspec:\n  size: 3\n  version: \"3.2.13\"\n```\n\nApply the version change to the cluster CR:\n\n```\n$ kubectl apply -f upgrade-example\n```\n\nWait ~30 seconds. The container image version should be updated to v3.2.13:\n\n```\n$ kubectl get pod example-etcd-cluster-795649v9kq -o yaml | grep \"image:\" | uniq\n    image: gcr.io/etcd-development/etcd:v3.2.13\n```\n\nCheck the other two pods and you should see the same result.\n\n\n### Backup and Restore an etcd cluster\n\u003e Note: The provided etcd backup/restore operators are example implementations.\n\nFollow the [etcd backup operator walkthrough](./doc/user/walkthrough/backup-operator.md) to backup an etcd cluster.\n\nFollow the [etcd restore operator walkthrough](./doc/user/walkthrough/restore-operator.md) to restore an etcd cluster on Kubernetes from backup.\n\n### Manage etcd clusters in all namespaces\n\nSee [instructions on clusterwide feature](doc/user/clusterwide.md).\n\n[k8s-home]: http://kubernetes.io\n","funding_links":[],"categories":["Operators","Application modules","Go","Repository is obsolete","operator候选列表"],"sub_categories":["[Jenkins](#jenkins)","Awesome Operators in the Wild","部署类型"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreos%2Fetcd-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoreos%2Fetcd-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoreos%2Fetcd-operator/lists"}