consul-server.yaml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. apiVersion: apps/v1
  2. kind: StatefulSet
  3. metadata:
  4. name: consul-server
  5. labels:
  6. name: consul-server
  7. spec:
  8. serviceName: consul-server
  9. selector:
  10. matchLabels:
  11. name: consul-server
  12. replicas: 3
  13. template:
  14. metadata:
  15. labels:
  16. name: consul-server
  17. spec:
  18. terminationGracePeriodSeconds: 10
  19. containers:
  20. - name: consul
  21. image: consul:latest
  22. imagePullPolicy: IfNotPresent
  23. args:
  24. - "agent"
  25. - "-server"
  26. - "-bootstrap-expect=3"
  27. - "-ui"
  28. - "-data-dir=/consul/data"
  29. - "-bind=0.0.0.0"
  30. - "-client=0.0.0.0"
  31. - "-advertise=$(POD_IP)"
  32. - "-retry-join=consul-server-0.consul-server.$(NAMESPACE).svc.cluster.local"
  33. - "-retry-join=consul-server-1.consul-server.$(NAMESPACE).svc.cluster.local"
  34. - "-retry-join=consul-server-2.consul-server.$(NAMESPACE).svc.cluster.local"
  35. - "-domain=cluster.local"
  36. - "-disable-host-node-id"
  37. env:
  38. - name: POD_IP
  39. valueFrom:
  40. fieldRef:
  41. fieldPath: status.podIP
  42. - name: NAMESPACE
  43. valueFrom:
  44. fieldRef:
  45. fieldPath: metadata.namespace
  46. ports:
  47. - containerPort: 8500
  48. name: http
  49. - containerPort: 8400
  50. name: rpc
  51. - containerPort: 8443
  52. name: https-port
  53. - containerPort: 8301
  54. name: serf-lan
  55. - containerPort: 8302
  56. name: serf-wan
  57. - containerPort: 8600
  58. name: consul-dns
  59. - containerPort: 8300
  60. name: server