Skip to content

Instantly share code, notes, and snippets.

@tmc
Created December 9, 2015 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmc/bc754362825ece76a3fd to your computer and use it in GitHub Desktop.
Save tmc/bc754362825ece76a3fd to your computer and use it in GitHub Desktop.
etcd static k8s cluster (no PV)
kind: "Service"
apiVersion: "v1"
metadata:
name: "etcd-static"
spec:
ports:
- targetPort: 2379
port: 80
selector:
app: "etcd-static"
---
kind: "Service"
apiVersion: "v1"
metadata:
name: "etcd-static0"
spec:
ports:
- port: 2379
name: client
- port: 2380
name: peer
selector:
etcd-name: etcd-static0
---
kind: "Service"
apiVersion: "v1"
metadata:
name: "etcd-static1"
spec:
ports:
- port: 2379
name: client
- port: 2380
name: peer
selector:
etcd-name: etcd-static1
---
kind: "Service"
apiVersion: "v1"
metadata:
name: "etcd-static2"
spec:
ports:
- port: 2379
name: client
- port: 2380
name: peer
selector:
etcd-name: etcd-static2
---
kind: "ReplicationController"
apiVersion: "v1"
metadata:
name: "etcd-static0"
spec:
replicas: 1
selector:
app: etcd-static
etcd-name: "etcd-static0"
template:
metadata:
labels:
app: etcd-static
etcd-name: "etcd-static0"
spec:
containers:
- name: etcd
image: quay.io/coreos/etcd
ports:
- containerPort: 2379
- containerPort: 2380
env:
- name: ETCD_DEBUG
value: "true"
- name: ETCD_NAME
value: "etcd-static0"
- name: ETCD_LISTEN_CLIENT_URLS
value: "http://0.0.0.0:2379"
- name: ETCD_LISTEN_PEER_URLS
value: "http://0.0.0.0:2380"
- name: ETCD_ADVERTISE_CLIENT_URLS
value: "http://etcd-static0:2379"
- name: ETCD_INITIAL_ADVERTISE_PEER_URLS
value: "http://etcd-static0:2380"
- name: ETCD_INITIAL_CLUSTER
value: "etcd-static0=http://etcd-static0:2380,etcd-static1=http://etcd-static1:2380,etcd-static2=http://etcd-static2:2380"
- name: ETCD_INITIAL_CLUSTER_STATE
value: "new"
- name: ETCD_DATA_DIR
value: "/var/lib/etcd"
volumeMounts:
- name: etcd
mountPath: "/var/lib/etcd"
volumes:
- name: etcd
emptyDir:
---
kind: "ReplicationController"
apiVersion: "v1"
metadata:
name: "etcd-static1"
spec:
replicas: 1
selector:
app: etcd-static
etcd-name: "etcd-static1"
template:
metadata:
labels:
app: etcd-static
etcd-name: "etcd-static1"
spec:
containers:
- name: etcd
image: quay.io/coreos/etcd
ports:
- containerPort: 2379
- containerPort: 2380
env:
- name: ETCD_NAME
value: "etcd-static1"
- name: ETCD_LISTEN_CLIENT_URLS
value: "http://0.0.0.0:2379"
- name: ETCD_LISTEN_PEER_URLS
value: "http://0.0.0.0:2380"
- name: ETCD_ADVERTISE_CLIENT_URLS
value: "http://etcd-static1:2379"
- name: ETCD_INITIAL_ADVERTISE_PEER_URLS
value: "http://etcd-static1:2380"
- name: ETCD_INITIAL_CLUSTER
value: "etcd-static0=http://etcd-static0:2380,etcd-static1=http://etcd-static1:2380,etcd-static2=http://etcd-static2:2380"
- name: ETCD_INITIAL_CLUSTER_STATE
value: "new"
- name: ETCD_DATA_DIR
value: "/var/lib/etcd"
volumeMounts:
- name: etcd
mountPath: "/var/lib/etcd"
volumes:
- name: etcd
emptyDir:
---
kind: "ReplicationController"
apiVersion: "v1"
metadata:
name: "etcd-static2"
spec:
replicas: 1
selector:
app: etcd-static
etcd-name: "etcd-static2"
template:
metadata:
labels:
app: etcd-static
etcd-name: "etcd-static2"
spec:
containers:
- name: etcd
image: base/k8s-etcd
ports:
- containerPort: 2379
- containerPort: 2380
env:
- name: ETCD_NAME
value: "etcd-static2"
- name: ETCD_LISTEN_CLIENT_URLS
value: "http://0.0.0.0:2379"
- name: ETCD_LISTEN_PEER_URLS
value: "http://0.0.0.0:2380"
- name: ETCD_ADVERTISE_CLIENT_URLS
value: "http://etcd-static2:2379"
- name: ETCD_INITIAL_ADVERTISE_PEER_URLS
value: "http://etcd-static2:2380"
- name: ETCD_INITIAL_CLUSTER
value: "etcd-static0=http://etcd-static0:2380,etcd-static1=http://etcd-static1:2380,etcd-static2=http://etcd-static2:2380"
- name: ETCD_INITIAL_CLUSTER_STATE
value: "new"
- name: ETCD_DATA_DIR
value: "/var/lib/etcd"
volumeMounts:
- name: etcd
mountPath: "/var/lib/etcd"
volumes:
- name: etcd
emptyDir:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment