blob: 34b1fc8023d361171a7f287bae3e68db8bdbf30e [file] [log] [blame]
Richard Jankowski54f7a862017-12-20 13:31:10 -05001apiVersion: v1
2kind: Service
3metadata:
4 name: consul
5 labels:
6 name: consul
7spec:
Richard Jankowskic3c291c2018-02-02 13:57:33 -05008 type: ClusterIP
Richard Jankowski54f7a862017-12-20 13:31:10 -05009 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---
45apiVersion: apps/v1beta1
46kind: StatefulSet
47metadata:
48 name: consul
49spec:
50 serviceName: consul
51 replicas: 3
52 template:
53 metadata:
54 labels:
55 app: consul
Stephane Barbarie5e8d9e42018-02-07 16:15:05 -050056 annotations:
57 cni: "weave"
Richard Jankowski54f7a862017-12-20 13:31:10 -050058 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 Jankowski54f7a862017-12-20 13:31:10 -050091 - "-data-dir=/consul/data"
Richard Jankowski54f7a862017-12-20 13:31:10 -050092 - "-server"
93 - "-ui"
Richard Jankowski54f7a862017-12-20 13:31:10 -050094 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