es-sts-2.4.4.yaml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. apiVersion: apps/v1
  2. kind: StatefulSet
  3. metadata:
  4. name: es-cluster
  5. spec:
  6. serviceName: elasticsearch
  7. replicas: 3
  8. selector:
  9. matchLabels:
  10. app: elasticsearch
  11. template:
  12. metadata:
  13. labels:
  14. app: elasticsearch
  15. spec:
  16. volumes:
  17. - name: data
  18. emptyDir: {}
  19. containers:
  20. - name: elasticsearch
  21. #image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.3
  22. image: dotbalo/es:2.4.6-cluster
  23. imagePullPolicy: Always
  24. resources:
  25. limits:
  26. cpu: 1000m
  27. requests:
  28. cpu: 100m
  29. ports:
  30. - containerPort: 9200
  31. name: rest
  32. protocol: TCP
  33. - containerPort: 9300
  34. name: inter-node
  35. protocol: TCP
  36. volumeMounts:
  37. - name: data
  38. mountPath: /usr/share/elasticsearch/data
  39. env:
  40. - name: "cluster.name"
  41. value: "pscm-cluster"
  42. - name: "CLUSTER_NAME"
  43. value: "pscm-cluster"
  44. - name: "discovery.zen.minimum_master_nodes"
  45. value: "2"
  46. - name: "MINIMUM_MASTER_NODES"
  47. value: "2"
  48. - name: "node.name"
  49. valueFrom:
  50. fieldRef:
  51. fieldPath: metadata.name
  52. - name: "NODE_NAME"
  53. valueFrom:
  54. fieldRef:
  55. fieldPath: metadata.name
  56. - name: "discovery.zen.ping.unicast.hosts"
  57. value: "es-cluster-0.elasticsearch, es-cluster-1.elasticsearch, es-cluster-2.elasticsearch"
  58. #- name: ES_JAVA_OPTS
  59. # value: "-Xms512m -Xmx512m"
  60. initContainers:
  61. - name: fix-permissions
  62. image: busybox
  63. command: ["sh", "-c", "chown -R 1000:1000 /usr/share/elasticsearch/data"]
  64. securityContext:
  65. privileged: true
  66. volumeMounts:
  67. - name: data
  68. mountPath: /usr/share/elasticsearch/data
  69. - name: increase-vm-max-map
  70. image: busybox
  71. command: ["sysctl", "-w", "vm.max_map_count=262144"]
  72. securityContext:
  73. privileged: true
  74. - name: increase-fd-ulimit
  75. image: busybox
  76. command: ["sh", "-c", "ulimit -n 65536"]
  77. securityContext:
  78. privileged: true
  79. # volumeClaimTemplates:
  80. # - metadata:
  81. # name: data
  82. # spec:
  83. # accessModes: [ "ReadWriteOnce" ]
  84. # storageClassName: "es-storage-class"
  85. # resources:
  86. # requests:
  87. # storage: 10Gi