forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
232 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# etcd on Kubernetes | ||
|
||
This is an example setting up etcd as a set of pods and services running on top of kubernetes. Using: | ||
|
||
``` | ||
$ kubectl create -f etcd.yml | ||
services/etcd-client | ||
pods/etcd0 | ||
services/etcd0 | ||
pods/etcd1 | ||
services/etcd1 | ||
pods/etcd2 | ||
services/etcd2 | ||
$ # now deploy a service that consumes etcd, such as vulcand | ||
$ kubectl create -f vulcand.yml | ||
``` | ||
|
||
TODO: | ||
|
||
- create a replication controller like service that knows how to add and remove nodes from the cluster correctly | ||
- use kubernetes secrets API to configure TLS for etcd clients and peers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: etcd-client | ||
spec: | ||
ports: | ||
- name: etcd-client-port | ||
port: 2379 | ||
protocol: TCP | ||
targetPort: 2379 | ||
selector: | ||
app: etcd | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app: etcd | ||
etcd_node: etcd0 | ||
name: etcd0 | ||
spec: | ||
containers: | ||
- command: | ||
- /etcd | ||
- -name | ||
- etcd0 | ||
- -initial-advertise-peer-urls | ||
- http://etcd0:2380 | ||
- -listen-peer-urls | ||
- http://0.0.0.0:2380 | ||
- -listen-client-urls | ||
- http://0.0.0.0:2379 | ||
- -advertise-client-urls | ||
- http://etcd0:2379 | ||
- -initial-cluster | ||
- etcd0=http://etcd0:2380,etcd1=http://etcd1:2380,etcd2=http://etcd2:2380 | ||
- -initial-cluster-state | ||
- new | ||
image: quay.io/coreos/etcd:latest | ||
name: etcd0 | ||
ports: | ||
- containerPort: 2379 | ||
name: client | ||
protocol: TCP | ||
- containerPort: 2380 | ||
name: server | ||
protocol: TCP | ||
restartPolicy: Never | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
etcd_node: etcd0 | ||
name: etcd0 | ||
spec: | ||
ports: | ||
- name: client | ||
port: 2379 | ||
protocol: TCP | ||
targetPort: 2379 | ||
- name: server | ||
port: 2380 | ||
protocol: TCP | ||
targetPort: 2380 | ||
selector: | ||
etcd_node: etcd0 | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app: etcd | ||
etcd_node: etcd1 | ||
name: etcd1 | ||
spec: | ||
containers: | ||
- command: | ||
- /etcd | ||
- -name | ||
- etcd1 | ||
- -initial-advertise-peer-urls | ||
- http://etcd1:2380 | ||
- -listen-peer-urls | ||
- http://0.0.0.0:2380 | ||
- -listen-client-urls | ||
- http://0.0.0.0:2379 | ||
- -advertise-client-urls | ||
- http://etcd1:2379 | ||
- -initial-cluster | ||
- etcd0=http://etcd0:2380,etcd1=http://etcd1:2380,etcd2=http://etcd2:2380 | ||
- -initial-cluster-state | ||
- new | ||
image: quay.io/coreos/etcd:latest | ||
name: etcd1 | ||
ports: | ||
- containerPort: 2379 | ||
name: client | ||
protocol: TCP | ||
- containerPort: 2380 | ||
name: server | ||
protocol: TCP | ||
restartPolicy: Never | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
etcd_node: etcd1 | ||
name: etcd1 | ||
spec: | ||
ports: | ||
- name: client | ||
port: 2379 | ||
protocol: TCP | ||
targetPort: 2379 | ||
- name: server | ||
port: 2380 | ||
protocol: TCP | ||
targetPort: 2380 | ||
selector: | ||
etcd_node: etcd1 | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app: etcd | ||
etcd_node: etcd2 | ||
name: etcd2 | ||
spec: | ||
containers: | ||
- command: | ||
- /etcd | ||
- -name | ||
- etcd2 | ||
- -initial-advertise-peer-urls | ||
- http://etcd2:2380 | ||
- -listen-peer-urls | ||
- http://0.0.0.0:2380 | ||
- -listen-client-urls | ||
- http://0.0.0.0:2379 | ||
- -advertise-client-urls | ||
- http://etcd2:2379 | ||
- -initial-cluster | ||
- etcd0=http://etcd0:2380,etcd1=http://etcd1:2380,etcd2=http://etcd2:2380 | ||
- -initial-cluster-state | ||
- new | ||
image: quay.io/coreos/etcd:latest | ||
name: etcd2 | ||
ports: | ||
- containerPort: 2379 | ||
name: client | ||
protocol: TCP | ||
- containerPort: 2380 | ||
name: server | ||
protocol: TCP | ||
restartPolicy: Never | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
etcd_node: etcd2 | ||
name: etcd2 | ||
spec: | ||
ports: | ||
- name: client | ||
port: 2379 | ||
protocol: TCP | ||
targetPort: 2379 | ||
- name: server | ||
port: 2380 | ||
protocol: TCP | ||
targetPort: 2380 | ||
selector: | ||
etcd_node: etcd2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
labels: | ||
app: vulcand | ||
name: vulcand | ||
spec: | ||
containers: | ||
- command: | ||
- /go/bin/vulcand | ||
- -apiInterface=0.0.0.0 | ||
- --etcd=http://etcd-client:2379 | ||
image: mailgun/vulcand:v0.8.0-beta.2 | ||
name: vulcand | ||
ports: | ||
- containerPort: 8081 | ||
name: api | ||
protocol: TCP | ||
- containerPort: 8082 | ||
name: server | ||
protocol: TCP | ||
restartPolicy: Always |