apiVersion: v1 kind: Service metadata: name: etcd namespace: iloom spec: clusterIP: None ports: - name: client port: 2379 targetPort: 2379 - name: peer port: 2380 targetPort: 2380 selector: app: etcd --- apiVersion: apps/v1 kind: StatefulSet metadata: name: etcd namespace: iloom spec: serviceName: etcd replicas: 1 selector: matchLabels: app: etcd template: metadata: labels: app: etcd spec: imagePullSecrets: - name: harbor-pull-secret containers: - name: etcd image: harbor-in-k3s.cheverjohn.me/iloom/etcd:v3.5.17 ports: - containerPort: 2379 name: client - containerPort: 2380 name: peer env: - name: ETCD_NAME value: "etcd-0" - name: ETCD_DATA_DIR value: "/etcd-data" - name: ETCD_LISTEN_CLIENT_URLS value: "http://0.0.0.0:2379" - name: ETCD_ADVERTISE_CLIENT_URLS value: "http://etcd:2379" - name: ETCD_LISTEN_PEER_URLS value: "http://0.0.0.0:2380" - name: ETCD_INITIAL_ADVERTISE_PEER_URLS value: "http://etcd-0.etcd:2380" - name: ETCD_INITIAL_CLUSTER value: "etcd-0=http://etcd-0.etcd:2380" - name: ETCD_INITIAL_CLUSTER_STATE value: "new" volumeMounts: - name: etcd-data mountPath: /etcd-data resources: requests: cpu: 100m memory: 128Mi limits: cpu: 500m memory: 256Mi readinessProbe: exec: command: ["etcdctl", "endpoint", "health", "--endpoints=http://localhost:2379"] initialDelaySeconds: 10 periodSeconds: 10 livenessProbe: exec: command: ["etcdctl", "endpoint", "health", "--endpoints=http://localhost:2379"] initialDelaySeconds: 30 periodSeconds: 30 volumeClaimTemplates: - metadata: name: etcd-data spec: accessModes: ["ReadWriteOnce"] storageClassName: longhorn resources: requests: storage: 1Gi