111 lines
3.1 KiB
YAML
111 lines
3.1 KiB
YAML
---
|
|
# etcd StatefulSet for distributed coordination
|
|
# Used by Towerops for distributed process locking
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: etcd
|
|
namespace: towerops
|
|
labels:
|
|
app: etcd
|
|
spec:
|
|
ports:
|
|
- port: 2379
|
|
name: client
|
|
- port: 2380
|
|
name: peer
|
|
clusterIP: None
|
|
publishNotReadyAddresses: true
|
|
selector:
|
|
app: etcd
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: etcd
|
|
namespace: towerops
|
|
spec:
|
|
serviceName: etcd
|
|
replicas: 3
|
|
podManagementPolicy: Parallel
|
|
selector:
|
|
matchLabels:
|
|
app: etcd
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: etcd
|
|
spec:
|
|
containers:
|
|
- name: etcd
|
|
image: gcr.io/etcd-development/etcd:v3.5.11
|
|
ports:
|
|
- containerPort: 2379
|
|
name: client
|
|
- containerPort: 2380
|
|
name: peer
|
|
env:
|
|
- name: ETCD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: ETCD_INITIAL_CLUSTER
|
|
value: "etcd-0=http://etcd-0.etcd.towerops.svc.cluster.local:2380,etcd-1=http://etcd-1.etcd.towerops.svc.cluster.local:2380,etcd-2=http://etcd-2.etcd.towerops.svc.cluster.local:2380"
|
|
- name: ETCD_INITIAL_CLUSTER_STATE
|
|
value: "new"
|
|
- name: ETCD_INITIAL_CLUSTER_TOKEN
|
|
value: "towerops-etcd"
|
|
- name: ETCD_LISTEN_CLIENT_URLS
|
|
value: "http://0.0.0.0:2379"
|
|
- name: ETCD_ADVERTISE_CLIENT_URLS
|
|
value: "http://$(ETCD_NAME).etcd.towerops.svc.cluster.local:2379"
|
|
- name: ETCD_LISTEN_PEER_URLS
|
|
value: "http://0.0.0.0:2380"
|
|
- name: ETCD_INITIAL_ADVERTISE_PEER_URLS
|
|
value: "http://$(ETCD_NAME).etcd.towerops.svc.cluster.local:2380"
|
|
- name: ETCD_AUTO_COMPACTION_RETENTION
|
|
value: "1" # Keep 1 hour of history
|
|
- name: ETCD_QUOTA_BACKEND_BYTES
|
|
value: "8589934592" # 8GB
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "512Mi"
|
|
cpu: "500m"
|
|
volumeMounts:
|
|
- name: etcd-data
|
|
mountPath: /var/run/etcd
|
|
startupProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 2379
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 30
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 2379
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /health
|
|
port: 2379
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 5
|
|
timeoutSeconds: 3
|
|
failureThreshold: 3
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: etcd-data
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
resources:
|
|
requests:
|
|
storage: 10Gi
|