How to run an etcd cluster among pod replicas? How to run an etcd cluster among pod replicas? kubernetes kubernetes

How to run an etcd cluster among pod replicas?


You can deploy etcd on kubernetes using an Operator (from the extensions/v1beta1) and the quay.io/coreos/etcd-operator image.

An example deployment with a cluster size of 3 looks like this:

apiVersion: extensions/v1beta1kind: Deploymentmetadata:  name: etcd-operatorspec:  replicas: 1  template:    metadata:      name: etcd-operator      labels:        app: etcd        component: operator    spec:      containers:      - name: etcd-operator        image: quay.io/coreos/etcd-operator:v0.3.0        env:        - name: MY_POD_NAMESPACE          valueFrom: { fieldRef: { fieldPath: metadata.namespace } }        - name: MY_POD_NAME          valueFrom: { fieldRef: { fieldPath: metadata.name } }---apiVersion: etcd.coreos.com/v1beta1kind: Clustermetadata:  name: etcd-cluster  labels:    app: etcd    component: clusterspec:  size: 3  version: "3.1.8"

Please be aware of the beta status of this project. However according to the maintainers the operator is now stable. I have deployed the configuration above successfully but I didn't run any of this in production.

The operator code is available on github. You can find additional documentation there.


There's a pretty good example of a three node etcd cluster here: https://github.com/coreos/etcd/tree/master/hack/kubernetes-deploy

They make use of separate rc's and services for each replica as a workaround until nominal services are added.


I added your question to kubernetes/kubernetes#5017

If someone knows the answer, they will hopefully post it there.

I think it may require the "nominal services" feature (kubernetes/kubernetes#260) which is not implemented yet, but I'm not sure.