apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: etcd
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: etcd
  serviceName: etcd
  template:
    metadata:
      labels:
        app.kubernetes.io/name: etcd
    spec:
      enableServiceLinks: false
      containers:
        - name: etcd
          image: k8s.gcr.io/etcd:3.5.0-0
          command:
            - /usr/local/bin/etcd
          args:
            - --data-dir=/data
            - --listen-client-urls=http://0.0.0.0:2379
            - --advertise-client-urls=http://$(POP_IP):2379
            - --auto-compaction-retention=1
          env:
            - name: POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
          ports:
            - containerPort: 2379
              name: etcd
          volumeMounts:
            - mountPath: /data
              name: data
      volumes:
        - name: data
          hostPath:
            path: /opt/c33/etcd/etcd
