es-sts.yaml 2.3 KB

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