Skip to content

Latest commit

 

History

History
141 lines (113 loc) · 2.9 KB

spec_examples.md

File metadata and controls

141 lines (113 loc) · 2.9 KB

Cluster Spec Examples

Three member cluster

spec:
  size: 3

This will use the default version chosen by the etcd-operator.

Three member cluster with version specified

spec:
  size: 3
  version: "3.2.13"

Three member cluster with node selector and anti-affinity across nodes

Note: change $cluster_name to the EtcdCluster's name.

spec:
  size: 3
  pod:
    nodeSelector:
      diskType: ssd
    affinity:
      podAntiAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
        - labelSelector:
            matchExpressions:
            - key: etcd_cluster
              operator: In
              values: ["$cluster_name"]
          topologyKey: kubernetes.io/hostname

For other topology keys, see https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ .

Three member cluster with preferred anti-affinity between pods and nodes (place pods in different nodes if possible)

Note: change $cluster_name to the EtcdCluster's name.

spec:
  size: 3
  pod:
    affinity:
      podAntiAffinity:
        preferredDuringSchedulingIgnoredDuringExecution:
        - weight: 100
          podAffinityTerm:
            labelSelector:
              matchExpressions:
              - key: etcd_cluster
                operator: In
                values:
                - $cluster_name
            topologyKey: kubernetes.io/hostname

Three member cluster with resource requirement

spec:
  size: 3
  pod:
    resources:
      limits:
        cpu: 300m
        memory: 200Mi
      requests:
        cpu: 200m
        memory: 100Mi

Custom etcd configuration

etcd members could be configured via env: https://coreos.com/etcd/docs/latest/op-guide/configuration.html

spec:
  size: 3
  pod:
    etcdEnv:
    - name: ETCD_AUTO_COMPACTION_RETENTION
      value: "1"

TLS

For more information on working with TLS, see Cluster TLS policy.

Custom pod annotations

spec:
  size: 3
  pod:
    annotations:
      prometheus.io/scrape: "true"
      prometheus.io/port: "2379"

Custom pod security context

For more information on pod security context see the Kubernetes docs.

spec:
  size: 3
  pod:
    securityContext:
      runAsNonRoot: true
      runAsUser: 9000
      # The FSGroup is needed to let the etcd container access mounted volumes
      fsGroup: 9000

Custom PersistentVolumeClaim definition

Note: Change $STORAGECLASS for your preferred StorageClass or remove the line to use the default one.

spec:
  size: 3
  pod:
    persistentVolumeClaimSpec:
      storageClassName: $STORAGECLASS
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 1Gi