init commit
This commit is contained in:
122
02-etcd.yaml
Normal file
122
02-etcd.yaml
Normal file
@@ -0,0 +1,122 @@
|
||||
##############################################################################
|
||||
# etcd cluster for M3DB placement & topology
|
||||
# M3DB requires etcd for cluster coordination
|
||||
##############################################################################
|
||||
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: etcd
|
||||
namespace: m3db
|
||||
labels:
|
||||
app.kubernetes.io/name: etcd
|
||||
app.kubernetes.io/part-of: m3db
|
||||
spec:
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: client
|
||||
port: 2379
|
||||
targetPort: 2379
|
||||
- name: peer
|
||||
port: 2380
|
||||
targetPort: 2380
|
||||
selector:
|
||||
app.kubernetes.io/name: etcd
|
||||
|
||||
---
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: etcd
|
||||
namespace: m3db
|
||||
labels:
|
||||
app.kubernetes.io/name: etcd
|
||||
app.kubernetes.io/part-of: m3db
|
||||
spec:
|
||||
serviceName: etcd
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: etcd
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: etcd
|
||||
app.kubernetes.io/part-of: m3db
|
||||
spec:
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: app.kubernetes.io/name
|
||||
operator: In
|
||||
values:
|
||||
- etcd
|
||||
topologyKey: kubernetes.io/hostname
|
||||
containers:
|
||||
- name: etcd
|
||||
image: quay.io/coreos/etcd:v3.5.15
|
||||
ports:
|
||||
- containerPort: 2379
|
||||
name: client
|
||||
- containerPort: 2380
|
||||
name: peer
|
||||
env:
|
||||
- name: POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: CLUSTER_SIZE
|
||||
value: "3"
|
||||
command:
|
||||
- /bin/sh
|
||||
- -ec
|
||||
- |
|
||||
PEERS=""
|
||||
for i in $(seq 0 $((${CLUSTER_SIZE} - 1))); do
|
||||
PEERS="${PEERS}${PEERS:+,}etcd-${i}=http://etcd-${i}.etcd.m3db.svc.cluster.local:2380"
|
||||
done
|
||||
|
||||
exec etcd \
|
||||
--name=${POD_NAME} \
|
||||
--listen-peer-urls=http://0.0.0.0:2380 \
|
||||
--listen-client-urls=http://0.0.0.0:2379 \
|
||||
--advertise-client-urls=http://${POD_NAME}.etcd.m3db.svc.cluster.local:2379 \
|
||||
--initial-advertise-peer-urls=http://${POD_NAME}.etcd.m3db.svc.cluster.local:2380 \
|
||||
--initial-cluster=${PEERS} \
|
||||
--initial-cluster-state=new \
|
||||
--data-dir=/var/lib/etcd/data \
|
||||
--auto-compaction-retention=1
|
||||
volumeMounts:
|
||||
- name: etcd-data
|
||||
mountPath: /var/lib/etcd
|
||||
resources:
|
||||
requests:
|
||||
cpu: 200m
|
||||
memory: 256Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 2379
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 10
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 2379
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: etcd-data
|
||||
spec:
|
||||
storageClassName: vultr-block-storage-m3db
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: 10Gi
|
||||
Reference in New Issue
Block a user