Guest User

Untitled

a guest
Mar 22nd, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. ---
  2. apiVersion: v1
  3. kind: ConfigMap
  4. metadata:
  5. name: filebeat-config
  6. namespace: kube-system
  7. labels:
  8. k8s-app: filebeat
  9. kubernetes.io/cluster-service: "true"
  10. data:
  11. filebeat.yml: |-
  12. filebeat.autodiscover:
  13. providers:
  14. - type: kubernetes
  15. templates:
  16. - condition:
  17. equals: kubernetes.namespace: development
  18. config:
  19. - type: docker
  20. containers.ids:
  21. - "${data.kubernetes.container.id}"
  22.  
  23. processors:
  24. - add_cloud_metadata:
  25.  
  26. cloud.id: ${ELASTIC_CLOUD_ID}
  27. cloud.auth: ${ELASTIC_CLOUD_AUTH}
  28.  
  29. output.elasticsearch:
  30. hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
  31. username: ${ELASTICSEARCH_USERNAME}
  32. password: ${ELASTICSEARCH_PASSWORD}
  33. ---
  34. apiVersion: extensions/v1beta1
  35. kind: DaemonSet
  36. metadata:
  37. name: filebeat
  38. namespace: kube-system
  39. labels:
  40. k8s-app: filebeat
  41. kubernetes.io/cluster-service: "true"
  42. spec:
  43. template:
  44. metadata:
  45. labels:
  46. k8s-app: filebeat
  47. kubernetes.io/cluster-service: "true"
  48. spec:
  49. serviceAccountName: filebeat
  50. terminationGracePeriodSeconds: 30
  51. containers:
  52. - name: filebeat
  53. image: docker.elastic.co/beats/filebeat:6.2.2
  54. args: [
  55. "-c", "/etc/filebeat.yml",
  56. "-e",
  57. ]
  58. env:
  59. - name: ELASTICSEARCH_HOST
  60. value: elasticsearch
  61. - name: ELASTICSEARCH_PORT
  62. value: "9200"
  63. - name: ELASTICSEARCH_USERNAME
  64. value: elastic
  65. - name: ELASTICSEARCH_PASSWORD
  66. value: changeme
  67. - name: ELASTIC_CLOUD_ID
  68. value:
  69. - name: ELASTIC_CLOUD_AUTH
  70. value:
  71. securityContext:
  72. runAsUser: 0
  73. resources:
  74. limits:
  75. memory: 200Mi
  76. requests:
  77. cpu: 100m
  78. memory: 100Mi
  79. volumeMounts:
  80. - name: config
  81. mountPath: /etc/filebeat.yml
  82. readOnly: true
  83. subPath: filebeat.yml
  84. - name: data
  85. mountPath: /usr/share/filebeat/data
  86. - name: varlibdockercontainers
  87. mountPath: /var/lib/docker/containers
  88. readOnly: true
  89. volumes:
  90. - name: config
  91. configMap:
  92. defaultMode: 0600
  93. name: filebeat-config
  94. - name: varlibdockercontainers
  95. hostPath:
  96. path: /var/lib/docker/containers
  97. # We set an `emptyDir` here to ensure the manifest will deploy correctly.
  98. # It's recommended to change this to a `hostPath` folder, to ensure internal data
  99. # files survive pod changes (ie: version upgrade)
  100. - name: data
  101. emptyDir: {}
  102. ---
  103. apiVersion: rbac.authorization.k8s.io/v1beta1
  104. kind: ClusterRoleBinding
  105. metadata:
  106. name: filebeat
  107. subjects:
  108. - kind: ServiceAccount
  109. name: filebeat
  110. namespace: kube-system
  111. roleRef:
  112. kind: ClusterRole
  113. name: filebeat
  114. apiGroup: rbac.authorization.k8s.io
  115. ---
  116. apiVersion: rbac.authorization.k8s.io/v1beta1
  117. kind: ClusterRole
  118. metadata:
  119. name: filebeat
  120. labels:
  121. k8s-app: filebeat
  122. rules:
  123. - apiGroups: [""] # "" indicates the core API group
  124. resources:
  125. - namespaces
  126. - pods
  127. verbs:
  128. - get
  129. - watch
  130. - list
  131. ---
  132. apiVersion: v1
  133. kind: ServiceAccount
  134. metadata:
  135. name: filebeat
  136. namespace: kube-system
  137. labels:
  138. k8s-app: filebeat
  139. ---
Add Comment
Please, Sign In to add comment