version: '2.1'
services:
  etcd:
    environment:
      ETCD_DATA_DIR: /var/lib/etcd
    image: uhub.ucloud.cn/pingcap/etcd:v3.2.24
    volumes:
      - ./_data/etcd:/var/lib/etcd
    ports:
      - "2379"
    command:
      - /usr/local/bin/etcd
      - --name=etcd
      - --advertise-client-urls=http://etcd:2379
      - --initial-advertise-peer-urls=http://etcd:2380
      - --listen-client-urls=http://0.0.0.0:2379
      - --listen-peer-urls=http://0.0.0.0:2380
      - --initial-cluster=etcd=http://etcd:2380
    healthcheck:
      test: etcdctl --endpoint=http://etcd:2379 cluster-health
      timeout: 10s
      interval: 2s
      retries: 5
  apiserver:
    image: uhub.ucloud.cn/pingcap/kube-apiserver:v1.12.2
    ports:
      - "8080:8080"
    command:
      - kube-apiserver
      - --bind-address=0.0.0.0
      - --insecure-bind-address=0.0.0.0
      - --insecure-port=8080
      - --storage-backend=etcd3
      - --etcd-servers=http://etcd:2379
    depends_on:
      etcd:
        condition: service_healthy
