Richard Jankowski | 54f7a86 | 2017-12-20 13:31:10 -0500 | [diff] [blame] | 1 | apiVersion: v1 |
| 2 | kind: Service |
| 3 | metadata: |
| 4 | name: consul |
| 5 | labels: |
| 6 | name: consul |
| 7 | spec: |
Richard Jankowski | c3c291c | 2018-02-02 13:57:33 -0500 | [diff] [blame] | 8 | type: ClusterIP |
Richard Jankowski | 54f7a86 | 2017-12-20 13:31:10 -0500 | [diff] [blame] | 9 | clusterIP: None |
| 10 | ports: |
| 11 | - name: http |
| 12 | port: 8500 |
| 13 | targetPort: 8500 |
| 14 | - name: https |
| 15 | port: 8443 |
| 16 | targetPort: 8443 |
| 17 | - name: rpc |
| 18 | port: 8400 |
| 19 | targetPort: 8400 |
| 20 | - name: serflan-tcp |
| 21 | protocol: "TCP" |
| 22 | port: 8301 |
| 23 | targetPort: 8301 |
| 24 | - name: serflan-udp |
| 25 | protocol: "UDP" |
| 26 | port: 8301 |
| 27 | targetPort: 8301 |
| 28 | - name: serfwan-tcp |
| 29 | protocol: "TCP" |
| 30 | port: 8302 |
| 31 | targetPort: 8302 |
| 32 | - name: serfwan-udp |
| 33 | protocol: "UDP" |
| 34 | port: 8302 |
| 35 | targetPort: 8302 |
| 36 | - name: server |
| 37 | port: 8300 |
| 38 | targetPort: 8300 |
| 39 | - name: consuldns |
| 40 | port: 8600 |
| 41 | targetPort: 8600 |
| 42 | selector: |
| 43 | app: consul |
| 44 | --- |
| 45 | apiVersion: apps/v1beta1 |
| 46 | kind: StatefulSet |
| 47 | metadata: |
| 48 | name: consul |
| 49 | spec: |
| 50 | serviceName: consul |
| 51 | replicas: 3 |
| 52 | template: |
| 53 | metadata: |
| 54 | labels: |
| 55 | app: consul |
Stephane Barbarie | 5e8d9e4 | 2018-02-07 16:15:05 -0500 | [diff] [blame] | 56 | annotations: |
| 57 | cni: "weave" |
Richard Jankowski | 54f7a86 | 2017-12-20 13:31:10 -0500 | [diff] [blame] | 58 | spec: |
| 59 | affinity: |
| 60 | podAntiAffinity: |
| 61 | requiredDuringSchedulingIgnoredDuringExecution: |
| 62 | - labelSelector: |
| 63 | matchExpressions: |
| 64 | - key: app |
| 65 | operator: In |
| 66 | values: |
| 67 | - consul |
| 68 | topologyKey: kubernetes.io/hostname |
| 69 | terminationGracePeriodSeconds: 10 |
| 70 | containers: |
| 71 | - name: consul |
| 72 | image: "consul:0.9.2" |
| 73 | env: |
| 74 | - name: POD_IP |
| 75 | valueFrom: |
| 76 | fieldRef: |
| 77 | fieldPath: status.podIP |
| 78 | - name: NAMESPACE |
| 79 | valueFrom: |
| 80 | fieldRef: |
| 81 | fieldPath: metadata.namespace |
| 82 | args: |
| 83 | - "agent" |
| 84 | - "-bind=0.0.0.0" |
| 85 | - "-bootstrap-expect=3" |
| 86 | - "-retry-join=consul-0.consul.$(NAMESPACE).svc.cluster.local" |
| 87 | - "-retry-join=consul-1.consul.$(NAMESPACE).svc.cluster.local" |
| 88 | - "-retry-join=consul-2.consul.$(NAMESPACE).svc.cluster.local" |
| 89 | - "-client=0.0.0.0" |
| 90 | - "-config-dir=/consul/config" |
Richard Jankowski | 54f7a86 | 2017-12-20 13:31:10 -0500 | [diff] [blame] | 91 | - "-data-dir=/consul/data" |
Richard Jankowski | 54f7a86 | 2017-12-20 13:31:10 -0500 | [diff] [blame] | 92 | - "-server" |
| 93 | - "-ui" |
Richard Jankowski | 54f7a86 | 2017-12-20 13:31:10 -0500 | [diff] [blame] | 94 | lifecycle: |
| 95 | preStop: |
| 96 | exec: |
| 97 | command: |
| 98 | - /bin/sh |
| 99 | - -c |
| 100 | - consul leave |
| 101 | ports: |
| 102 | - containerPort: 8500 |
| 103 | name: ui-port |
| 104 | - containerPort: 8400 |
| 105 | name: alt-port |
| 106 | - containerPort: 53 |
| 107 | name: udp-port |
| 108 | - containerPort: 8443 |
| 109 | name: https-port |
| 110 | - containerPort: 8080 |
| 111 | name: http-port |
| 112 | - containerPort: 8301 |
| 113 | name: serflan |
| 114 | - containerPort: 8302 |
| 115 | name: serfwan |
| 116 | - containerPort: 8600 |
| 117 | name: consuldns |
| 118 | - containerPort: 8300 |
| 119 | name: server |