github.com/looshlee/cilium@v1.6.12/examples/kubernetes/addons/etcd/standalone-etcd.yaml (about)

     1  ###############################################################################
     2  #
     3  # This is a standalone etcd deployment for PoC or testing purposes. It runs a
     4  # single replica etcd using host networking. Data is stored in /var/etcd on the
     5  # host's disk. A scheduling toleration allows it to be scheduled before the
     6  # cluster is ready. A scheduling anti affinity ensures that never more than one
     7  # instance is running per node. A NodePort service makes etcd avaiable on a
     8  # stable address on all nodes without requiring DNS resolution to work
     9  #
    10  # etcd address:
    11  #   http://127.0.0.1:31079
    12  #
    13  ###############################################################################
    14  
    15  apiVersion: v1
    16  kind: Service
    17  metadata:
    18    name: "etcd-cilium"
    19    annotations:
    20      # Create endpoints also if the related pod isn't ready
    21      service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
    22  spec:
    23    ports:
    24    - port: 32379
    25      name: client
    26      nodePort: 31079
    27    - port: 32380
    28      name: peer
    29      nodePort: 31080
    30    type: NodePort
    31    selector:
    32      component: "cilium-etcd"
    33  ---
    34  apiVersion: apps/v1beta1
    35  kind: StatefulSet
    36  metadata:
    37    name: "etcd-cilium"
    38    labels:
    39      component: "cilium-etcd"
    40  spec:
    41    serviceName: "cilium-etcd"
    42    template:
    43      metadata:
    44        name: "etcd"
    45        labels:
    46          component: "cilium-etcd"
    47      spec:
    48        hostNetwork: true
    49        affinity:
    50          podAntiAffinity:
    51            requiredDuringSchedulingIgnoredDuringExecution:
    52              - labelSelector:
    53                  matchExpressions:
    54                    - key: "component"
    55                      operator: In
    56                      values:
    57                      - cilium-etcd
    58                topologyKey: "kubernetes.io/hostname"
    59        containers:
    60        - name: "etcd"
    61          image: "quay.io/coreos/etcd:v3.3.2"
    62          env:
    63          - name: HOSTNAME_IP
    64            valueFrom:
    65              fieldRef:
    66                fieldPath: status.podIP
    67          volumeMounts:
    68          - name: local-vol
    69            mountPath: /var/etcd
    70          command:
    71            - "/usr/local/bin/etcd"
    72          args:
    73            - --name=cilium-etcd-$(HOSTNAME_IP)
    74            - --listen-client-urls=http://0.0.0.0:32379
    75            - --listen-peer-urls=http://0.0.0.0:32380
    76            - --advertise-client-urls=http://$(HOSTNAME_IP):32379
    77            - --initial-cluster-token=cilium-etcd-cluster-1
    78            - --initial-cluster-state=new
    79            - --data-dir=/var/etcd/cilium-etcd/default.etcd
    80        volumes:
    81          - name: local-vol
    82            hostPath:
    83              path: /var/etcd