diff --git a/deploy/kubernetes/elastic-agent-standalone-kubernetes.yml b/deploy/kubernetes/elastic-agent-standalone-kubernetes.yml index f99281b6889..46b625fa0ce 100644 --- a/deploy/kubernetes/elastic-agent-standalone-kubernetes.yml +++ b/deploy/kubernetes/elastic-agent-standalone-kubernetes.yml @@ -23,10 +23,10 @@ spec: dnsPolicy: ClusterFirstWithHostNet containers: - name: elastic-agent - image: docker.elastic.co/beats/elastic-agent:7.12.0-SNAPSHOT + image: docker.elastic.co/beats/elastic-agent:8.0.0 args: [ "-c", "/etc/agent.yml", - "-e", "-d", "composable.providers.kubernetes", + "-e", ] env: - name: ES_USERNAME @@ -52,11 +52,35 @@ spec: mountPath: /etc/agent.yml readOnly: true subPath: agent.yml + - name: proc + mountPath: /hostfs/proc + readOnly: true + - name: cgroup + mountPath: /hostfs/sys/fs/cgroup + readOnly: true + - name: varlibdockercontainers + mountPath: /var/lib/docker/containers + readOnly: true + - name: varlog + mountPath: /var/log + readOnly: true volumes: - name: datastreams configMap: defaultMode: 0640 name: agent-node-datastreams + - name: proc + hostPath: + path: /proc + - name: cgroup + hostPath: + path: /sys/fs/cgroup + - name: varlibdockercontainers + hostPath: + path: /var/lib/docker/containers + - name: varlog + hostPath: + path: /var/log --- apiVersion: v1 kind: ConfigMap @@ -67,8 +91,6 @@ metadata: k8s-app: elastic-agent data: agent.yml: |- - id: ef9cc740-5bf0-11eb-8b51-39775155c3f5 - revision: 2 outputs: default: type: elasticsearch @@ -87,9 +109,120 @@ data: node: ${NODE_NAME} scope: node inputs: - - id: 934ef8aa-ed19-405b-8160-ebf62e3d32f8 - name: kubernetes-node-metrics - revision: 1 + - name: log-1 + type: logfile + use_output: default + meta: + package: + name: log + version: 0.4.6 + data_stream: + namespace: default + streams: + - data_stream: + dataset: generic + symlinks: true + paths: + - /var/log/containers/*${kubernetes.container.id}.log + - name: system-3 + type: system/metrics + use_output: default + meta: + package: + name: system + version: 0.10.9 + data_stream: + namespace: default + streams: + - data_stream: + dataset: system.core + type: metrics + metricsets: + - core + core.metrics: + - percentages + - data_stream: + dataset: system.cpu + type: metrics + period: 10s + cpu.metrics: + - percentages + - normalized_percentages + metricsets: + - cpu + - data_stream: + dataset: system.diskio + type: metrics + period: 10s + diskio.include_devices: null + metricsets: + - diskio + - data_stream: + dataset: system.filesystem + type: metrics + period: 1m + metricsets: + - filesystem + processors: + - drop_event.when.regexp: + system.filesystem.mount_point: ^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/) + - data_stream: + dataset: system.fsstat + type: metrics + period: 1m + metricsets: + - fsstat + processors: + - drop_event.when.regexp: + system.fsstat.mount_point: ^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/) + - data_stream: + dataset: system.load + type: metrics + period: 10s + metricsets: + - load + - data_stream: + dataset: system.memory + type: metrics + period: 10s + metricsets: + - memory + - data_stream: + dataset: system.network + type: metrics + period: 10s + network.interfaces: null + metricsets: + - network + - data_stream: + dataset: system.process + type: metrics + process.include_top_n.by_memory: 5 + period: 10s + processes: + - .* + process.include_top_n.by_cpu: 5 + process.cgroups.enabled: false + process.cmdline.cache.enabled: true + metricsets: + - process + process.include_cpu_ticks: false + system.hostfs: /hostfs + - data_stream: + dataset: system.process_summary + type: metrics + period: 10s + metricsets: + - process_summary + system.hostfs: /hostfs + - data_stream: + dataset: system.socket_summary + type: metrics + period: 10s + metricsets: + - socket_summary + system.hostfs: /hostfs + - name: kubernetes-node-metrics type: kubernetes/metrics use_output: default meta: @@ -99,9 +232,7 @@ data: data_stream: namespace: default streams: - - id: >- - kubernetes/metrics-kubernetes.controllermanager-3d50c483-2327-40e7-b3e5-d877d4763fe1 - data_stream: + - data_stream: dataset: kubernetes.controllermanager type: metrics metricsets: @@ -110,9 +241,7 @@ data: - '${kubernetes.pod.ip}:10252' period: 10s condition: ${kubernetes.pod.labels.component} == 'kube-controller-manager' - - id: >- - kubernetes/metrics-kubernetes.scheduler-3d50c483-2327-40e7-b3e5-d877d4763fe1 - data_stream: + - data_stream: dataset: kubernetes.scheduler type: metrics metricsets: @@ -121,9 +250,7 @@ data: - '${kubernetes.pod.ip}:10251' period: 10s condition: ${kubernetes.pod.labels.component} == 'kube-scheduler' - - id: >- - kubernetes/metrics-kubernetes.proxy-3d50c483-2327-40e7-b3e5-d877d4763fe1 - data_stream: + - data_stream: dataset: kubernetes.proxy type: metrics metricsets: @@ -131,9 +258,7 @@ data: hosts: - 'localhost:10249' period: 10s - - id: >- - kubernetes/metrics-kubernetes.container-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.container type: metrics metricsets: @@ -144,9 +269,7 @@ data: - 'https://${env.NODE_NAME}:10250' period: 10s ssl.verification_mode: none - - id: >- - kubernetes/metrics-kubernetes.node-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.node type: metrics metricsets: @@ -157,8 +280,7 @@ data: - 'https://${env.NODE_NAME}:10250' period: 10s ssl.verification_mode: none - - id: kubernetes/metrics-kubernetes.pod-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.pod type: metrics metricsets: @@ -169,9 +291,7 @@ data: - 'https://${env.NODE_NAME}:10250' period: 10s ssl.verification_mode: none - - id: >- - kubernetes/metrics-kubernetes.system-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.system type: metrics metricsets: @@ -182,9 +302,7 @@ data: - 'https://${env.NODE_NAME}:10250' period: 10s ssl.verification_mode: none - - id: >- - kubernetes/metrics-kubernetes.volume-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.volume type: metrics metricsets: @@ -215,10 +333,10 @@ spec: serviceAccountName: elastic-agent containers: - name: elastic-agent - image: docker.elastic.co/beats/elastic-agent:7.12.0-SNAPSHOT + image: docker.elastic.co/beats/elastic-agent:8.0.0 args: [ "-c", "/etc/agent.yml", - "-e", "-d", "composable.providers.kubernetes", + "-e", ] env: - name: ES_USERNAME @@ -265,8 +383,6 @@ metadata: data: # This part requires `kube-state-metrics` up and running under `kube-system` namespace agent.yml: |- - id: ef9cc740-5bf0-11eb-8b51-39775155c3f5 - revision: 2 outputs: default: type: elasticsearch @@ -282,9 +398,7 @@ data: logs: true metrics: true inputs: - - id: 934ef8aa-ed19-405b-8160-ebf62e3d32f9 - name: kubernetes-cluster-metrics - revision: 1 + - name: kubernetes-cluster-metrics type: kubernetes/metrics use_output: default meta: @@ -294,9 +408,7 @@ data: data_stream: namespace: default streams: - - id: >- - kubernetes/metrics-kubernetes.apiserver-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.apiserver type: metrics metricsets: @@ -307,18 +419,14 @@ data: period: 30s ssl.certificate_authorities: - /var/run/secrets/kubernetes.io/serviceaccount/ca.crt - - id: >- - kubernetes/metrics-kubernetes.event-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.event type: metrics metricsets: - event period: 10s add_metadata: true - - id: >- - kubernetes/metrics-kubernetes.state_container-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_container type: metrics metricsets: @@ -327,9 +435,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_cronjob-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_cronjob type: metrics metricsets: @@ -338,9 +444,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_deployment-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_deployment type: metrics metricsets: @@ -349,9 +453,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_node-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_node type: metrics metricsets: @@ -360,9 +462,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_persistentvolume-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_persistentvolume type: metrics metricsets: @@ -371,9 +471,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_persistentvolumeclaim-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_persistentvolumeclaim type: metrics metricsets: @@ -382,9 +480,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_pod-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_pod type: metrics metricsets: @@ -393,9 +489,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_replicaset-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_replicaset type: metrics metricsets: @@ -404,9 +498,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_resourcequota-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_resourcequota type: metrics metricsets: @@ -415,9 +507,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_service-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_service type: metrics metricsets: @@ -426,9 +516,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_statefulset-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_statefulset type: metrics metricsets: @@ -437,9 +525,7 @@ data: hosts: - 'kube-state-metrics:8080' period: 10s - - id: >- - kubernetes/metrics-kubernetes.state_storageclass-934ef8aa-ed19-405b-8160-ebf62e3d32f8 - data_stream: + - data_stream: dataset: kubernetes.state_storageclass type: metrics metricsets: @@ -475,7 +561,6 @@ rules: - namespaces - events - pods - - secrets verbs: ["get", "list", "watch"] - apiGroups: ["extensions"] resources: diff --git a/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-daemonset-configmap.yaml b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-daemonset-configmap.yaml new file mode 100644 index 00000000000..11c2992c93c --- /dev/null +++ b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-daemonset-configmap.yaml @@ -0,0 +1,231 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: agent-node-datastreams + namespace: kube-system + labels: + k8s-app: elastic-agent +data: + agent.yml: |- + outputs: + default: + type: elasticsearch + hosts: + - >- + ${ES_HOST} + username: ${ES_USERNAME} + password: ${ES_PASSWORD} + agent: + monitoring: + enabled: true + use_output: default + logs: true + metrics: true + providers.kubernetes: + node: ${NODE_NAME} + scope: node + inputs: + - name: log-1 + type: logfile + use_output: default + meta: + package: + name: log + version: 0.4.6 + data_stream: + namespace: default + streams: + - data_stream: + dataset: generic + symlinks: true + paths: + - /var/log/containers/*${kubernetes.container.id}.log + - name: system-3 + type: system/metrics + use_output: default + meta: + package: + name: system + version: 0.10.9 + data_stream: + namespace: default + streams: + - data_stream: + dataset: system.core + type: metrics + metricsets: + - core + core.metrics: + - percentages + - data_stream: + dataset: system.cpu + type: metrics + period: 10s + cpu.metrics: + - percentages + - normalized_percentages + metricsets: + - cpu + - data_stream: + dataset: system.diskio + type: metrics + period: 10s + diskio.include_devices: null + metricsets: + - diskio + - data_stream: + dataset: system.filesystem + type: metrics + period: 1m + metricsets: + - filesystem + processors: + - drop_event.when.regexp: + system.filesystem.mount_point: ^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/) + - data_stream: + dataset: system.fsstat + type: metrics + period: 1m + metricsets: + - fsstat + processors: + - drop_event.when.regexp: + system.fsstat.mount_point: ^/(sys|cgroup|proc|dev|etc|host|lib|snap)($|/) + - data_stream: + dataset: system.load + type: metrics + period: 10s + metricsets: + - load + - data_stream: + dataset: system.memory + type: metrics + period: 10s + metricsets: + - memory + - data_stream: + dataset: system.network + type: metrics + period: 10s + network.interfaces: null + metricsets: + - network + - data_stream: + dataset: system.process + type: metrics + process.include_top_n.by_memory: 5 + period: 10s + processes: + - .* + process.include_top_n.by_cpu: 5 + process.cgroups.enabled: false + process.cmdline.cache.enabled: true + metricsets: + - process + process.include_cpu_ticks: false + system.hostfs: /hostfs + - data_stream: + dataset: system.process_summary + type: metrics + period: 10s + metricsets: + - process_summary + system.hostfs: /hostfs + - data_stream: + dataset: system.socket_summary + type: metrics + period: 10s + metricsets: + - socket_summary + system.hostfs: /hostfs + - name: kubernetes-node-metrics + type: kubernetes/metrics + use_output: default + meta: + package: + name: kubernetes + version: 0.2.8 + data_stream: + namespace: default + streams: + - data_stream: + dataset: kubernetes.controllermanager + type: metrics + metricsets: + - controllermanager + hosts: + - '${kubernetes.pod.ip}:10252' + period: 10s + condition: ${kubernetes.pod.labels.component} == 'kube-controller-manager' + - data_stream: + dataset: kubernetes.scheduler + type: metrics + metricsets: + - scheduler + hosts: + - '${kubernetes.pod.ip}:10251' + period: 10s + condition: ${kubernetes.pod.labels.component} == 'kube-scheduler' + - data_stream: + dataset: kubernetes.proxy + type: metrics + metricsets: + - proxy + hosts: + - 'localhost:10249' + period: 10s + - data_stream: + dataset: kubernetes.container + type: metrics + metricsets: + - container + add_metadata: true + bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token + hosts: + - 'https://${env.NODE_NAME}:10250' + period: 10s + ssl.verification_mode: none + - data_stream: + dataset: kubernetes.node + type: metrics + metricsets: + - node + add_metadata: true + bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token + hosts: + - 'https://${env.NODE_NAME}:10250' + period: 10s + ssl.verification_mode: none + - data_stream: + dataset: kubernetes.pod + type: metrics + metricsets: + - pod + add_metadata: true + bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token + hosts: + - 'https://${env.NODE_NAME}:10250' + period: 10s + ssl.verification_mode: none + - data_stream: + dataset: kubernetes.system + type: metrics + metricsets: + - system + add_metadata: true + bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token + hosts: + - 'https://${env.NODE_NAME}:10250' + period: 10s + ssl.verification_mode: none + - data_stream: + dataset: kubernetes.volume + type: metrics + metricsets: + - volume + add_metadata: true + bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token + hosts: + - 'https://${env.NODE_NAME}:10250' + period: 10s + ssl.verification_mode: none diff --git a/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-daemonset.yaml b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-daemonset.yaml new file mode 100644 index 00000000000..e97e0743926 --- /dev/null +++ b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-daemonset.yaml @@ -0,0 +1,70 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: elastic-agent + namespace: kube-system + labels: + app: elastic-agent +spec: + selector: + matchLabels: + app: elastic-agent + template: + metadata: + labels: + app: elastic-agent + spec: + tolerations: + - key: node-role.kubernetes.io/master + effect: NoSchedule + serviceAccountName: elastic-agent + hostNetwork: true + dnsPolicy: ClusterFirstWithHostNet + containers: + - name: elastic-agent + image: docker.elastic.co/beats/elastic-agent:%VERSION% + args: [ + "-c", "/etc/agent.yml", + "-e", + ] + env: + - name: ES_USERNAME + value: "elastic" + - name: ES_PASSWORD + value: "" + - name: ES_HOST + value: "" + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + securityContext: + runAsUser: 0 + resources: + limits: + memory: 200Mi + requests: + cpu: 100m + memory: 100Mi + volumeMounts: + - name: datastreams + mountPath: /etc/agent.yml + readOnly: true + subPath: agent.yml + - name: proc + mountPath: /hostfs/proc + readOnly: true + - name: cgroup + mountPath: /hostfs/sys/fs/cgroup + readOnly: true + volumes: + - name: datastreams + configMap: + defaultMode: 0640 + name: agent-node-datastreams + - name: proc + hostPath: + path: /proc + - name: cgroup + hostPath: + path: /sys/fs/cgroup diff --git a/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-deployment-configmap.yaml b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-deployment-configmap.yaml new file mode 100644 index 00000000000..58a92665e4e --- /dev/null +++ b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-deployment-configmap.yaml @@ -0,0 +1,161 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: agent-deployment-datastreams + namespace: kube-system + labels: + k8s-app: elastic-agent +data: + # This part requires `kube-state-metrics` up and running under `kube-system` namespace + agent.yml: |- + outputs: + default: + type: elasticsearch + hosts: + - >- + ${ES_HOST} + username: ${ES_USERNAME} + password: ${ES_PASSWORD} + agent: + monitoring: + enabled: true + use_output: default + logs: true + metrics: true + inputs: + - name: kubernetes-cluster-metrics + type: kubernetes/metrics + use_output: default + meta: + package: + name: kubernetes + version: 0.2.8 + data_stream: + namespace: default + streams: + - data_stream: + dataset: kubernetes.apiserver + type: metrics + metricsets: + - apiserver + bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token + hosts: + - 'https://${env.KUBERNETES_SERVICE_HOST}:${env.KUBERNETES_SERVICE_PORT}' + period: 30s + ssl.certificate_authorities: + - /var/run/secrets/kubernetes.io/serviceaccount/ca.crt + - data_stream: + dataset: kubernetes.event + type: metrics + metricsets: + - event + period: 10s + add_metadata: true + - data_stream: + dataset: kubernetes.state_container + type: metrics + metricsets: + - state_container + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_cronjob + type: metrics + metricsets: + - state_cronjob + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_deployment + type: metrics + metricsets: + - state_deployment + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_node + type: metrics + metricsets: + - state_node + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_persistentvolume + type: metrics + metricsets: + - state_persistentvolume + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_persistentvolumeclaim + type: metrics + metricsets: + - state_persistentvolumeclaim + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_pod + type: metrics + metricsets: + - state_pod + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_replicaset + type: metrics + metricsets: + - state_replicaset + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_resourcequota + type: metrics + metricsets: + - state_resourcequota + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_service + type: metrics + metricsets: + - state_service + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_statefulset + type: metrics + metricsets: + - state_statefulset + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s + - data_stream: + dataset: kubernetes.state_storageclass + type: metrics + metricsets: + - state_storageclass + add_metadata: true + hosts: + - 'kube-state-metrics:8080' + period: 10s diff --git a/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-deployment.yaml b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-deployment.yaml new file mode 100644 index 00000000000..0def8b88571 --- /dev/null +++ b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-deployment.yaml @@ -0,0 +1,58 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: elastic-agent + namespace: kube-system + labels: + app: elastic-agent +spec: + selector: + matchLabels: + app: elastic-agent + template: + metadata: + labels: + app: elastic-agent + spec: + serviceAccountName: elastic-agent + containers: + - name: elastic-agent + image: docker.elastic.co/beats/elastic-agent:%VERSION% + args: [ + "-c", "/etc/agent.yml", + "-e", + ] + env: + - name: ES_USERNAME + value: "elastic" + - name: ES_PASSWORD + value: "" + - name: ES_HOST + value: "" + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + # this is needed because we cannot use hostNetwork + - name: HOSTNAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + securityContext: + runAsUser: 0 + resources: + limits: + memory: 200Mi + requests: + cpu: 100m + memory: 100Mi + volumeMounts: + - name: datastreams + mountPath: /etc/agent.yml + readOnly: true + subPath: agent.yml + volumes: + - name: datastreams + configMap: + defaultMode: 0640 + name: agent-deployment-datastreams diff --git a/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-role-binding.yaml b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-role-binding.yaml new file mode 100644 index 00000000000..b352b2901d0 --- /dev/null +++ b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-role-binding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: elastic-agent +subjects: + - kind: ServiceAccount + name: elastic-agent + namespace: kube-system +roleRef: + kind: ClusterRole + name: elastic-agent + apiGroup: rbac.authorization.k8s.io diff --git a/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-role.yaml b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-role.yaml new file mode 100644 index 00000000000..dcf2b4a5ff2 --- /dev/null +++ b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-role.yaml @@ -0,0 +1,35 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: elastic-agent + labels: + k8s-app: elastic-agent +rules: + - apiGroups: [""] + resources: + - nodes + - namespaces + - events + - pods + verbs: ["get", "list", "watch"] + - apiGroups: ["extensions"] + resources: + - replicasets + verbs: ["get", "list", "watch"] + - apiGroups: ["apps"] + resources: + - statefulsets + - deployments + - replicasets + verbs: ["get", "list", "watch"] + - apiGroups: + - "" + resources: + - nodes/stats + verbs: + - get + # required for apiserver + - nonResourceURLs: + - "/metrics" + verbs: + - get diff --git a/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-service-account.yaml b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-service-account.yaml new file mode 100644 index 00000000000..43372b547d0 --- /dev/null +++ b/deploy/kubernetes/elastic-agent-standalone/elastic-agent-standalone-service-account.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: elastic-agent + namespace: kube-system + labels: + k8s-app: elastic-agent