9cd91360cad755fad7bf32123d572b89f0e089cc.svn-base 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. apiVersion: apps/v1
  2. kind: DaemonSet
  3. metadata:
  4. name: consul-client
  5. labels:
  6. name: consul-client
  7. spec:
  8. selector:
  9. matchLabels:
  10. name: consul-client
  11. template:
  12. metadata:
  13. labels:
  14. name: consul-client
  15. spec:
  16. containers:
  17. - name: consul
  18. image: consul:latest
  19. imagePullPolicy: IfNotPresent
  20. args:
  21. - "agent"
  22. - "-data-dir=/consul/data"
  23. - "-bind=0.0.0.0"
  24. - "-client=0.0.0.0"
  25. - "-advertise=$(POD_IP)"
  26. - "-retry-join=consul-server-0.consul-server.$(NAMESPACE).svc.cluster.local"
  27. - "-retry-join=consul-server-1.consul-server.$(NAMESPACE).svc.cluster.local"
  28. - "-retry-join=consul-server-2.consul-server.$(NAMESPACE).svc.cluster.local"
  29. - "-domain=cluster.local"
  30. - "-disable-host-node-id"
  31. env:
  32. - name: POD_IP
  33. valueFrom:
  34. fieldRef:
  35. fieldPath: status.podIP
  36. - name: NAMESPACE
  37. valueFrom:
  38. fieldRef:
  39. fieldPath: metadata.namespace
  40. lifecycle:
  41. postStart:
  42. exec:
  43. command:
  44. - /bin/sh
  45. - -c
  46. - consul reload
  47. preStop:
  48. exec:
  49. command:
  50. - /bin/sh
  51. - -c
  52. - consul leave
  53. volumeMounts:
  54. - name: consul-data-dir
  55. mountPath: /consul/data
  56. ports:
  57. - containerPort: 8500
  58. hostPort: 8500
  59. name: http
  60. - containerPort: 8400
  61. name: rpc
  62. - containerPort: 8443
  63. name: https
  64. - containerPort: 8301
  65. name: serf-lan
  66. - containerPort: 8302
  67. name: serf-wan
  68. - containerPort: 8600
  69. name: consul
  70. - containerPort: 8300
  71. name: server
  72. volumes:
  73. - name: consul-data-dir
  74. hostPath:
  75. path: /Users/xuan/desktop/consul/data
  76. type: DirectoryOrCreate