| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: consul |
| namespace: voltha |
| labels: |
| name: consul |
| spec: |
| type: ClusterIP |
| clusterIP: None |
| ports: |
| - name: http |
| port: 8500 |
| targetPort: 8500 |
| - name: https |
| port: 8443 |
| targetPort: 8443 |
| - name: rpc |
| port: 8400 |
| targetPort: 8400 |
| - name: serflan-tcp |
| protocol: "TCP" |
| port: 8301 |
| targetPort: 8301 |
| - name: serflan-udp |
| protocol: "UDP" |
| port: 8301 |
| targetPort: 8301 |
| - name: serfwan-tcp |
| protocol: "TCP" |
| port: 8302 |
| targetPort: 8302 |
| - name: serfwan-udp |
| protocol: "UDP" |
| port: 8302 |
| targetPort: 8302 |
| - name: server |
| port: 8300 |
| targetPort: 8300 |
| - name: consuldns |
| port: 8600 |
| targetPort: 8600 |
| selector: |
| app: consul |
| --- |
| apiVersion: apps/v1beta1 |
| kind: StatefulSet |
| metadata: |
| name: consul |
| namespace: voltha |
| spec: |
| serviceName: consul |
| replicas: 3 |
| template: |
| metadata: |
| labels: |
| app: consul |
| annotations: |
| cni: "weave" |
| spec: |
| affinity: |
| podAntiAffinity: |
| requiredDuringSchedulingIgnoredDuringExecution: |
| - labelSelector: |
| matchExpressions: |
| - key: app |
| operator: In |
| values: |
| - consul |
| topologyKey: kubernetes.io/hostname |
| terminationGracePeriodSeconds: 10 |
| containers: |
| - name: consul |
| image: "consul:0.9.2" |
| volumeMounts: |
| - name: consul-config |
| mountPath: /consul/config |
| - name: consul-data |
| mountPath: /consul/data |
| env: |
| - name: NAMESPACE |
| valueFrom: |
| fieldRef: |
| fieldPath: metadata.namespace |
| args: |
| - "agent" |
| - "-server" |
| - "-bootstrap-expect=3" |
| - "-config-dir=/consul/config" |
| - "-data-dir=/consul/data" |
| - "-bind=0.0.0.0" |
| - "-client=0.0.0.0" |
| - "-ui" |
| - "-raft-protocol=3" |
| - "-rejoin" |
| - "-retry-join=consul-0.consul.$(NAMESPACE).svc.cluster.local" |
| - "-retry-join=consul-1.consul.$(NAMESPACE).svc.cluster.local" |
| - "-retry-join=consul-2.consul.$(NAMESPACE).svc.cluster.local" |
| lifecycle: |
| preStop: |
| exec: |
| command: |
| - /bin/sh |
| - -c |
| - consul leave |
| ports: |
| - containerPort: 8500 |
| name: ui-port |
| - containerPort: 8400 |
| name: alt-port |
| - containerPort: 53 |
| name: udp-port |
| - containerPort: 8443 |
| name: https-port |
| - containerPort: 8080 |
| name: http-port |
| - containerPort: 8301 |
| name: serflan |
| - containerPort: 8302 |
| name: serfwan |
| - containerPort: 8600 |
| name: consuldns |
| - containerPort: 8300 |
| name: server |
| volumes: |
| - name: consul-config |
| hostPath: |
| path: /cord/incubator/voltha/consul/config |
| type: Directory |
| - name: consul-data |
| hostPath: |
| path: /cord/incubator/voltha/consul/data |
| type: Directory |