Guest User

Untitled

a guest
Oct 28th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.13 KB | None | 0 0
  1. apiVersion: v1
  2. kind: ConfigMap
  3. metadata:
  4. name: metricbeat-daemonset-config
  5. namespace: kube-system
  6. labels:
  7. k8s-app: metricbeat
  8. data:
  9. metricbeat.yml: |-
  10. metricbeat.config.modules:
  11. # Mounted `metricbeat-daemonset-modules` configmap:
  12. path: ${path.config}/modules.d/*.yml
  13. # Reload module configs as they change:
  14. reload.enabled: false
  15. # To enable hints based autodiscover uncomment this:
  16. #metricbeat.autodiscover:
  17. # providers:
  18. # - type: kubernetes
  19. # host: ${NODE_NAME}
  20. # hints.enabled: true
  21.  
  22. processors:
  23. - add_cloud_metadata:
  24.  
  25. cloud.id: ${ELASTIC_CLOUD_ID}
  26. cloud.auth: ${ELASTIC_CLOUD_AUTH}
  27.  
  28. output.elasticsearch:
  29. hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
  30. username: ${ELASTICSEARCH_USERNAME}
  31. password: ${ELASTICSEARCH_PASSWORD}
  32. ---
  33. apiVersion: v1
  34. kind: ConfigMap
  35. metadata:
  36. name: metricbeat-daemonset-modules
  37. namespace: kube-system
  38. labels:
  39. k8s-app: metricbeat
  40. data:
  41. system.yml: |-
  42. - module: system
  43. period: 10s
  44. metricsets:
  45. - cpu
  46. - load
  47. - memory
  48. - network
  49. - process
  50. - process_summary
  51. #- core
  52. #- diskio
  53. #- socket
  54. processes: ['.*']
  55. process.include_top_n:
  56. by_cpu: 5 # include top 5 processes by CPU
  57. by_memory: 5 # include top 5 processes by memory
  58.  
  59. - module: system
  60. period: 1m
  61. metricsets:
  62. - filesystem
  63. - fsstat
  64. processors:
  65. - drop_event.when.regexp:
  66. system.filesystem.mount_point: '^/(sys|cgroup|proc|dev|etc|host|lib)($|/)'
  67. kubernetes.yml: |-
  68. - module: kubernetes
  69. metricsets:
  70. - node
  71. - system
  72. - pod
  73. - container
  74. - volume
  75. period: 10s
  76. host: ${NODE_NAME}
  77. hosts: ["localhost:10255"]
  78. # If using Red Hat OpenShift remove the previous hosts entry and
  79. # uncomment these settings:
  80. #hosts: ["https://${HOSTNAME}:10250"]
  81. #bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
  82. #ssl.certificate_authorities:
  83. #- /var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt
  84. - module: kubernetes
  85. metricsets:
  86. - proxy
  87. period: 10s
  88. host: ${NODE_NAME}
  89. hosts: ["localhost:10249"]
  90. ---
  91. # Deploy a Metricbeat instance per node for node metrics retrieval
  92. apiVersion: extensions/v1beta1
  93. kind: DaemonSet
  94. metadata:
  95. name: metricbeat
  96. namespace: kube-system
  97. labels:
  98. k8s-app: metricbeat
  99. spec:
  100. template:
  101. metadata:
  102. labels:
  103. k8s-app: metricbeat
  104. spec:
  105. serviceAccountName: metricbeat
  106. terminationGracePeriodSeconds: 30
  107. hostNetwork: true
  108. dnsPolicy: ClusterFirstWithHostNet
  109. containers:
  110. - name: metricbeat
  111. image: docker.elastic.co/beats/metricbeat:7.4.1
  112. args: [
  113. "-c", "/etc/metricbeat.yml",
  114. "-e",
  115. "-system.hostfs=/hostfs",
  116. ]
  117. env:
  118. - name: ELASTICSEARCH_HOST
  119. value: elasticsearch
  120. - name: ELASTICSEARCH_PORT
  121. value: "9200"
  122. - name: ELASTICSEARCH_USERNAME
  123. value: elastic
  124. - name: ELASTICSEARCH_PASSWORD
  125. value: changeme
  126. - name: ELASTIC_CLOUD_ID
  127. value: "removed"
  128. - name: ELASTIC_CLOUD_AUTH
  129. value: "removed"
  130. - name: NODE_NAME
  131. valueFrom:
  132. fieldRef:
  133. fieldPath: spec.nodeName
  134. securityContext:
  135. runAsUser: 0
  136. resources:
  137. limits:
  138. memory: 200Mi
  139. requests:
  140. cpu: 100m
  141. memory: 100Mi
  142. volumeMounts:
  143. - name: config
  144. mountPath: /etc/metricbeat.yml
  145. readOnly: true
  146. subPath: metricbeat.yml
  147. - name: modules
  148. mountPath: /usr/share/metricbeat/modules.d
  149. readOnly: true
  150. - name: dockersock
  151. mountPath: /var/run/docker.sock
  152. - name: proc
  153. mountPath: /hostfs/proc
  154. readOnly: true
  155. - name: cgroup
  156. mountPath: /hostfs/sys/fs/cgroup
  157. readOnly: true
  158. volumes:
  159. - name: proc
  160. hostPath:
  161. path: /proc
  162. - name: cgroup
  163. hostPath:
  164. path: /sys/fs/cgroup
  165. - name: dockersock
  166. hostPath:
  167. path: /var/run/docker.sock
  168. - name: config
  169. configMap:
  170. defaultMode: 0600
  171. name: metricbeat-daemonset-config
  172. - name: modules
  173. configMap:
  174. defaultMode: 0600
  175. name: metricbeat-daemonset-modules
  176. - name: data
  177. hostPath:
  178. path: /var/lib/metricbeat-data
  179. type: DirectoryOrCreate
  180. ---
  181. apiVersion: v1
  182. kind: ConfigMap
  183. metadata:
  184. name: metricbeat-deployment-config
  185. namespace: kube-system
  186. labels:
  187. k8s-app: metricbeat
  188. data:
  189. metricbeat.yml: |-
  190. metricbeat.config.modules:
  191. # Mounted `metricbeat-daemonset-modules` configmap:
  192. path: ${path.config}/modules.d/*.yml
  193. # Reload module configs as they change:
  194. reload.enabled: false
  195.  
  196. processors:
  197. - add_cloud_metadata:
  198.  
  199. cloud.id: ${ELASTIC_CLOUD_ID}
  200. cloud.auth: ${ELASTIC_CLOUD_AUTH}
  201.  
  202. output.elasticsearch:
  203. hosts: ['${ELASTICSEARCH_HOST:elasticsearch}:${ELASTICSEARCH_PORT:9200}']
  204. username: ${ELASTICSEARCH_USERNAME}
  205. password: ${ELASTICSEARCH_PASSWORD}
  206. ---
  207. apiVersion: v1
  208. kind: ConfigMap
  209. metadata:
  210. name: metricbeat-deployment-modules
  211. namespace: kube-system
  212. labels:
  213. k8s-app: metricbeat
  214. data:
  215. # This module requires `kube-state-metrics` up and running under `kube-system` namespace
  216. kubernetes.yml: |-
  217. - module: kubernetes
  218. metricsets:
  219. - state_node
  220. - state_deployment
  221. - state_replicaset
  222. - state_pod
  223. - state_container
  224. # Uncomment this to get k8s events:
  225. #- event
  226. period: 10s
  227. host: ${NODE_NAME}
  228. hosts: ["kube-state-metrics:8080"]
  229. ---
  230. # Deploy singleton instance in the whole cluster for some unique data sources, like kube-state-metrics
  231. apiVersion: apps/v1beta1
  232. kind: Deployment
  233. metadata:
  234. name: metricbeat
  235. namespace: kube-system
  236. labels:
  237. k8s-app: metricbeat
  238. spec:
  239. template:
  240. metadata:
  241. labels:
  242. k8s-app: metricbeat
  243. spec:
  244. serviceAccountName: metricbeat
  245. hostNetwork: true
  246. dnsPolicy: ClusterFirstWithHostNet
  247. containers:
  248. - name: metricbeat
  249. image: docker.elastic.co/beats/metricbeat:7.4.1
  250. args: [
  251. "-c", "/etc/metricbeat.yml",
  252. "-e",
  253. ]
  254. env:
  255. - name: ELASTICSEARCH_HOST
  256. value: elasticsearch
  257. - name: ELASTICSEARCH_PORT
  258. value: "9200"
  259. - name: ELASTICSEARCH_USERNAME
  260. value: elastic
  261. - name: ELASTICSEARCH_PASSWORD
  262. value: changeme
  263. - name: ELASTIC_CLOUD_ID
  264. value: "removed"
  265. - name: ELASTIC_CLOUD_AUTH
  266. value: "removed"
  267. - name: NODE_NAME
  268. valueFrom:
  269. fieldRef:
  270. fieldPath: spec.nodeName
  271. securityContext:
  272. runAsUser: 0
  273. resources:
  274. limits:
  275. memory: 200Mi
  276. requests:
  277. cpu: 100m
  278. memory: 100Mi
  279. volumeMounts:
  280. - name: config
  281. mountPath: /etc/metricbeat.yml
  282. readOnly: true
  283. subPath: metricbeat.yml
  284. - name: modules
  285. mountPath: /usr/share/metricbeat/modules.d
  286. readOnly: true
  287. volumes:
  288. - name: config
  289. configMap:
  290. defaultMode: 0600
  291. name: metricbeat-deployment-config
  292. - name: modules
  293. configMap:
  294. defaultMode: 0600
  295. name: metricbeat-deployment-modules
  296. ---
  297. apiVersion: rbac.authorization.k8s.io/v1beta1
  298. kind: ClusterRoleBinding
  299. metadata:
  300. name: metricbeat
  301. subjects:
  302. - kind: ServiceAccount
  303. name: metricbeat
  304. namespace: kube-system
  305. roleRef:
  306. kind: ClusterRole
  307. name: metricbeat
  308. apiGroup: rbac.authorization.k8s.io
  309. ---
  310. apiVersion: rbac.authorization.k8s.io/v1beta1
  311. kind: ClusterRole
  312. metadata:
  313. name: metricbeat
  314. labels:
  315. k8s-app: metricbeat
  316. rules:
  317. - apiGroups: [""]
  318. resources:
  319. - nodes
  320. - namespaces
  321. - events
  322. - pods
  323. verbs: ["get", "list", "watch"]
  324. - apiGroups: ["extensions"]
  325. resources:
  326. - replicasets
  327. verbs: ["get", "list", "watch"]
  328. - apiGroups: ["apps"]
  329. resources:
  330. - statefulsets
  331. - deployments
  332. - replicasets
  333. verbs: ["get", "list", "watch"]
  334. - apiGroups:
  335. - ""
  336. resources:
  337. - nodes/stats
  338. verbs:
  339. - get
  340. ---
  341. apiVersion: v1
  342. kind: ServiceAccount
  343. metadata:
  344. name: metricbeat
  345. namespace: kube-system
  346. labels:
  347. k8s-app: metricbeat
  348. ---
Advertisement
Add Comment
Please, Sign In to add comment