elasticsearch.yaml 3.1 KB

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