These docs cover everything from setting up and running an etcd operator to setting up and manage etcd clusters.
1 - Overview
TODO
2 - Getting Started
Follow these instructions to install, run, and test etcd with etcd-operator in a Kubernetes cluster.
Pre-requisites:
- kubectl
- Kubernetes cluster and
kubectl
configured to use it- If you don’t have a Kubernetes cluster, you can use kind to create a local one
- cert-manager installed in the cluster
Install etcd-operator:
kubectl apply -f https://github.com/aenix-io/etcd-operator/releases/latest/download/etcd-operator.yaml
Check the operator is running:
kubectl get pods -n etcd-operator-system -l control-plane=controller-manager
Create a simple etcd cluster:
kubectl apply -f https://github.com/aenix-io/etcd-operator/raw/main/examples/manifests/etcdcluster-simple.yaml
Caution: by default emptyDir storage is used. It means such cluster configuration is not intended for long-term storage.
Check the etcd cluster is running:
kubectl get pods -l app.kubernetes.io/managed-by=etcd-operator
3 - Examples
You can find examples for deploying etcd clusters in various configuration in the GitHub repository under examples/manifests directory.
This directory provides various manifests that can help you understand how to set up etcd clusters using the etcd-operator.
4 - Reference
TODO
5 - Contribution Guidelines
etcd operator guide for developers.
How to start contributing
First of all, etcd operator uses kubebuilder. See official docs to learn more.
Easy way
Using this way, you don’t be able to debug the controller locally. After every change you will have to redeploy changes.
Pre-requisites
- Any docker-like container tool, “docker” by default. For more information search for:
CONTAINER_TOOL
in Makefile. - kubectl
Steps
Create and prepare kind cluster:
make kind-prepare
Build image and load it into kind cluster:
make kind-load
Deploy CRDs, etcd-operator, RBAC, webhook certs into kind cluster:
make deploy
To deploy your code changes, load a new image and redeploy etcd-operator:
make kind-load && make redeploy
To clean up after all, delete kind cluster:
make kind-delete
Advanced way
Using VSCode you can connect your IDE to a pod in kubernetes cluster and use go run cmd/main.go
from the pod.
It will allow you to debug easily and faster integrate code changes to you develop environment.
General steps
- Install VSCode Kubernetes extension.
- Install VSCode Dev Containers extension.
- Create pvc to store operator code, go modules and your files.
- Build Dockerfile to create image for your develop environment (git, golang , etc…). Take base image that you love most.
- Patch operator deployment to
- Attach PVC from step 3.
- Change operator image to your image.
- Change command and args to endless sleep loop.
- Change rolling update strategy to recreate if you use RWO storage class.
- Change security context RunAsNonRoot to false.
- Increase requests and limits.
- Remove readiness and liveness probes.
- Attach VSCode to a running container through Kubernetes extension.
- Install necessary extensions to the container. They will be preserved after container restart if you attached pvc to home directory.
- Run
go run cmd/main.go
.
Release procedure
Every PR should have a label to show what kind of changes does it bring. For example, PRs with docs changes should have
documentation
label. This labels will be used by the release-drafter
workflow to prepare the release draft.
Cutting off a release
When all tasks for the release are merged to main
branch, maintainer should
- create new minor or major version in
site
if it’s not a patch release and merge this PR tomain
branch - check that tag has not been already created. If it has been, delete it
- publish the release using draft, created by
release-drafter
- you are amazing :)