etcd cluster podman ARM64, x86_64

Node 1 (10.0.0.181)
version: "3.8"

services:
  etcd:
    image: quay.io/coreos/etcd:v3.5.16
    container_name: etcd
    network_mode: host
    restart: unless-stopped

    command:
      - /usr/local/bin/etcd
      - --name=node1
      - --data-dir=/etcd-data
      - --listen-peer-urls=http://10.0.0.181:2380
      - --listen-client-urls=http://10.0.0.181:2379,http://127.0.0.1:2379
      - --advertise-client-urls=http://10.0.0.181:2379
      - --initial-advertise-peer-urls=http://10.0.0.181:2380
      - --initial-cluster=node1=http://10.0.0.181:2380,node2=http://10.0.0.249:2380,node3=http://10.0.0.170:2380
      - --initial-cluster-state=new
      - --initial-cluster-token=etcd-cluster-1

    tmpfs:
      - /etcd-data:size=100m
Node 2 (10.0.0.249)
version: "3.8"

services:
  etcd:
    image: quay.io/coreos/etcd:v3.5.16
    container_name: etcd
    network_mode: host
    restart: unless-stopped

    command:
      - /usr/local/bin/etcd
      - --name=node2
      - --data-dir=/etcd-data
      - --listen-peer-urls=http://10.0.0.249:2380
      - --listen-client-urls=http://10.0.0.249:2379,http://127.0.0.1:2379
      - --advertise-client-urls=http://10.0.0.249:2379
      - --initial-advertise-peer-urls=http://10.0.0.249:2380
      - --initial-cluster=node1=http://10.0.0.181:2380,node2=http://10.0.0.249:2380,node3=http://10.0.0.170:2380
      - --initial-cluster-state=new
      - --initial-cluster-token=etcd-cluster-1

    volumes:
      - ./data:/etcd-data
Node 3 (10.0.0.170)
version: "3.8"

services:
  etcd:
    image: quay.io/coreos/etcd:v3.5.16
    container_name: etcd
    network_mode: host
    restart: unless-stopped

    command:
      - /usr/local/bin/etcd
      - --name=node3
      - --data-dir=/etcd-data
      - --listen-peer-urls=http://10.0.0.170:2380
      - --listen-client-urls=http://10.0.0.170:2379,http://127.0.0.1:2379
      - --advertise-client-urls=http://10.0.0.170:2379
      - --initial-advertise-peer-urls=http://10.0.0.170:2380
      - --initial-cluster=node1=http://10.0.0.181:2380,node2=http://10.0.0.249:2380,node3=http://10.0.0.170:2380
      - --initial-cluster-state=new
      - --initial-cluster-token=etcd-cluster-1

    tmpfs:
      - /etcd-data:size=100m
List members:
podman exec etcd \
etcdctl \
  --endpoints=http://10.0.0.181:2379 \
  member list
It can print:
8211f1d0f64f3269, started, node1, http://10.0.0.181:2380, http://10.0.0.181:2379
91bc3c398fb3c146, started, node2, http://10.0.0.249:2380, http://10.0.0.249:2379
fd422379fda50e48, started, node3, http://10.0.0.170:2380, http://10.0.0.170:2379
Remove member:
podman exec etcd \
etcdctl \
  --endpoints=http://10.0.0.181:2379 \
  member remove fd422379fda50e48

No comments: