apiVersion: apps/v1 kind: DaemonSet metadata: name: consul namespace: public-service spec: selector: matchLabels: app: consul component: client template: metadata: labels: app: consul component: client spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: "componment" operator: In values: - client topologyKey: "kubernetes.io/hostname" terminationGracePeriodSeconds: 10 containers: - name: consul image: consul:latest imagePullPolicy: IfNotPresent ports: - containerPort: 8500 name: http - containerPort: 8600 name: dns-tcp protocol: TCP - containerPort: 8600 name: dns-udp protocol: UDP - containerPort: 8301 name: serflan - containerPort: 8302 name: serfwan - containerPort: 8300 name: server env: - name: POD_IP valueFrom: fieldRef: fieldPath: status.podIP - name: NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace args: - "agent" - "-advertise=$(POD_IP)" - "-bind=0.0.0.0" - "-datacenter=dc1" - "-config-dir=/consul/userconfig" - "-data-dir=/consul/data" - "-disable-host-node-id=true" - "-domain=cluster.local" - "-retry-join=consul-server-0.consul-server.$(NAMESPACE).svc.cluster.local" - "-client=0.0.0.0" resources: limits: cpu: "50m" memory: "32Mi" requests: cpu: "50m" memory: "32Mi" lifecycle: preStop: exec: command: - /bin/sh - -c - consul leave volumeMounts: - name: data mountPath: /consul/data - name: user-config mountPath: /consul/userconfig volumes: - name: user-config configMap: name: consul-client-config - name: data emptyDir: {} securityContext: fsGroup: 1000 # volumeClaimTemplates: # - metadata: # name: data # spec: # accessModes: # - ReadWriteMany # storageClassName: "gluster-heketi-2" # resources: # requests: # storage: 10Gi