es-ss.yaml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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: v5.6.4
  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: v5.6.4
  67. template:
  68. metadata:
  69. labels:
  70. k8s-app: elasticsearch-logging
  71. version: v5.6.4
  72. kubernetes.io/cluster-service: "true"
  73. spec:
  74. serviceAccountName: elasticsearch-logging
  75. volumes:
  76. - name: elasticsearch-logging
  77. emptyDir: {}
  78. containers:
  79. - image: dotbalo/elasticsearch:v5.6.4
  80. name: elasticsearch-logging
  81. resources:
  82. # need more cpu upon initialization, therefore burstable class
  83. limits:
  84. cpu: 1000m
  85. requests:
  86. cpu: 100m
  87. ports:
  88. - containerPort: 9200
  89. name: db
  90. protocol: TCP
  91. - containerPort: 9300
  92. name: transport
  93. protocol: TCP
  94. volumeMounts:
  95. - name: elasticsearch-logging
  96. mountPath: /data
  97. env:
  98. - name: "NAMESPACE"
  99. valueFrom:
  100. fieldRef:
  101. fieldPath: metadata.namespace
  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. # volumeClaimTemplates:
  112. # - metadata:
  113. # name: elasticsearch-logging
  114. # spec:
  115. # accessModes: [ "ReadWriteOnce" ]
  116. # storageClassName: "es-storage-class"
  117. # resources:
  118. # requests:
  119. # storage: 10Gi