es-statefulset.yaml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # RBAC authn and authz
  2. apiVersion: v1
  3. kind: ServiceAccount
  4. metadata:
  5. name: elasticsearch-logging
  6. namespace: kube-system
  7. labels:
  8. k8s-app: elasticsearch-logging
  9. addonmanager.kubernetes.io/mode: Reconcile
  10. ---
  11. kind: ClusterRole
  12. apiVersion: rbac.authorization.k8s.io/v1
  13. metadata:
  14. name: elasticsearch-logging
  15. labels:
  16. k8s-app: elasticsearch-logging
  17. addonmanager.kubernetes.io/mode: Reconcile
  18. rules:
  19. - apiGroups:
  20. - ""
  21. resources:
  22. - "services"
  23. - "namespaces"
  24. - "endpoints"
  25. verbs:
  26. - "get"
  27. ---
  28. kind: ClusterRoleBinding
  29. apiVersion: rbac.authorization.k8s.io/v1
  30. metadata:
  31. namespace: kube-system
  32. name: elasticsearch-logging
  33. labels:
  34. k8s-app: elasticsearch-logging
  35. addonmanager.kubernetes.io/mode: Reconcile
  36. subjects:
  37. - kind: ServiceAccount
  38. name: elasticsearch-logging
  39. namespace: kube-system
  40. apiGroup: ""
  41. roleRef:
  42. kind: ClusterRole
  43. name: elasticsearch-logging
  44. apiGroup: ""
  45. ---
  46. # Elasticsearch deployment itself
  47. apiVersion: apps/v1
  48. kind: StatefulSet
  49. metadata:
  50. name: elasticsearch-logging
  51. namespace: kube-system
  52. labels:
  53. k8s-app: elasticsearch-logging
  54. version: v6.6.1
  55. addonmanager.kubernetes.io/mode: Reconcile
  56. spec:
  57. serviceName: elasticsearch-logging
  58. replicas: 2
  59. selector:
  60. matchLabels:
  61. k8s-app: elasticsearch-logging
  62. version: v6.7.2
  63. template:
  64. metadata:
  65. labels:
  66. k8s-app: elasticsearch-logging
  67. version: v6.7.2
  68. spec:
  69. serviceAccountName: elasticsearch-logging
  70. containers:
  71. - image: gcr.io/fluentd-elasticsearch/elasticsearch:v6.6.1
  72. name: elasticsearch-logging
  73. resources:
  74. # need more cpu upon initialization, therefore burstable class
  75. limits:
  76. cpu: 1000m
  77. requests:
  78. cpu: 100m
  79. ports:
  80. - containerPort: 9200
  81. name: db
  82. protocol: TCP
  83. - containerPort: 9300
  84. name: transport
  85. protocol: TCP
  86. volumeMounts:
  87. - name: elasticsearch-logging
  88. mountPath: /data
  89. env:
  90. - name: "NAMESPACE"
  91. valueFrom:
  92. fieldRef:
  93. fieldPath: metadata.namespace
  94. volumes:
  95. - name: elasticsearch-logging
  96. emptyDir: {}
  97. # Elasticsearch requires vm.max_map_count to be at least 262144.
  98. # If your OS already sets up this number to a higher value, feel free
  99. # to remove this init container.
  100. initContainers:
  101. - image: alpine:3.6
  102. command: ["/sbin/sysctl", "-w", "vm.max_map_count=262144"]
  103. name: elasticsearch-logging-init
  104. securityContext:
  105. privileged: true