blob: 86166f01213a36c510290d1d90a74b302beeac26 [file] [log] [blame]
Richard Jankowski54f7a862017-12-20 13:31:10 -05001apiVersion: v1
2kind: Service
3metadata:
4 name: consul
5 labels:
6 name: consul
7spec:
8 clusterIP: None
9 ports:
10 - name: http
11 port: 8500
12 targetPort: 8500
13 - name: https
14 port: 8443
15 targetPort: 8443
16 - name: rpc
17 port: 8400
18 targetPort: 8400
19 - name: serflan-tcp
20 protocol: "TCP"
21 port: 8301
22 targetPort: 8301
23 - name: serflan-udp
24 protocol: "UDP"
25 port: 8301
26 targetPort: 8301
27 - name: serfwan-tcp
28 protocol: "TCP"
29 port: 8302
30 targetPort: 8302
31 - name: serfwan-udp
32 protocol: "UDP"
33 port: 8302
34 targetPort: 8302
35 - name: server
36 port: 8300
37 targetPort: 8300
38 - name: consuldns
39 port: 8600
40 targetPort: 8600
41 selector:
42 app: consul
43---
44apiVersion: apps/v1beta1
45kind: StatefulSet
46metadata:
47 name: consul
48spec:
49 serviceName: consul
50 replicas: 3
51 template:
52 metadata:
53 labels:
54 app: consul
55 spec:
56 affinity:
57 podAntiAffinity:
58 requiredDuringSchedulingIgnoredDuringExecution:
59 - labelSelector:
60 matchExpressions:
61 - key: app
62 operator: In
63 values:
64 - consul
65 topologyKey: kubernetes.io/hostname
66 terminationGracePeriodSeconds: 10
67 containers:
68 - name: consul
69 image: "consul:0.9.2"
70 env:
71 - name: POD_IP
72 valueFrom:
73 fieldRef:
74 fieldPath: status.podIP
75 - name: NAMESPACE
76 valueFrom:
77 fieldRef:
78 fieldPath: metadata.namespace
79 args:
80 - "agent"
81 - "-bind=0.0.0.0"
82 - "-bootstrap-expect=3"
83 - "-retry-join=consul-0.consul.$(NAMESPACE).svc.cluster.local"
84 - "-retry-join=consul-1.consul.$(NAMESPACE).svc.cluster.local"
85 - "-retry-join=consul-2.consul.$(NAMESPACE).svc.cluster.local"
86 - "-client=0.0.0.0"
87 - "-config-dir=/consul/config"
88 - "-datacenter=dc1"
89 - "-data-dir=/consul/data"
90 - "-domain=cluster.local"
91 - "-server"
92 - "-ui"
93 - "-disable-host-node-id"
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