Carlos_T
(Carlos T)
June 17, 2023, 4:38pm
1
Hi all
I've install a ECK cluster in a 5 workers nodes K8s.
In the deployment I used a Metricbeat runs as DaemonSet for each worker node.
The problem Im having is that I'm not getting any document with information about the field/value metricset.name : "process".
I don't know why as 'process' has been included in my metricsets list.
This is how I set it:
apiVersion: beat.k8s.elastic.co/v1beta1
kind: Beat
metadata:
name: metricbeat
spec:
type: metricbeat
version: 8.6.2
elasticsearchRef:
name: elasticsearch
kibanaRef:
name: kibana
config:
metricbeat:
autodiscover:
providers:
- hints:
default_config: {}
enabled: "true"
node: ${NODE_NAME}
type: kubernetes
modules:
- module: system
period: 10s
metricsets:
- cpu
- load
- memory
- network
- process
- process_summary
process:
include_top_n:
by_cpu: 5
by_memory: 5
processes:
- .*
- module: system
period: 1m
metricsets:
- filesystem
- fsstat
- uptime
processors:
- drop_event:
when:
regexp:
system:
filesystem:
mount_point: ^/(sys|cgroup|proc|dev|etc|host|lib)($|/)
- module: kubernetes
period: 10s
node: ${NODE_NAME}
hosts:
- https://${NODE_NAME}:10250
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
ssl:
verification_mode: none
metricsets:
- node
- system
- pod
- container
- volume
processors:
- add_cloud_metadata: {}
- add_host_metadata: {}
- add_fields:
fields:
cliente: "MiCliente"
daemonSet:
podTemplate:
spec:
serviceAccountName: metricbeat
automountServiceAccountToken: true # some older Beat versions are depending on this settings presence in k8s context
containers:
- args:
- -e
- -c
- /etc/beat.yml
- -system.hostfs=/hostfs
name: metricbeat
volumeMounts:
- mountPath: /hostfs/sys/fs/cgroup
name: cgroup
- mountPath: /var/run/docker.sock
name: dockersock
- mountPath: /hostfs/proc
name: proc
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true # Allows to provide richer host metadata
securityContext:
runAsUser: 0
terminationGracePeriodSeconds: 30
volumes:
- hostPath:
path: /sys/fs/cgroup
name: cgroup
- hostPath:
path: /var/run/docker.sock
name: dockersock
- hostPath:
path: /proc
name: proc
The thing im not having any data for the metricset.name : "process"
for any of the workers nodes of the clusters. For other onpremise servers it works well and show data, but not for my workers where I have my metricbeat running as deamonset.
Any idea why this is like this?
Thank you very much and regards.
Carlos T
stephenb
(Stephen Brown)
June 17, 2023, 5:19pm
2
perhaps try
- '.*'
Single quotes or the documented
processes: ['.*']
Carlos_T
(Carlos T)
June 18, 2023, 10:05am
3
Hi Stephen. Thank you for the fast answer.
I've tried both ways without success.
Anyway I've got an other environment with k3s where I will try the same config to get more conclutions.
Just so everybody has more info I get here the whole metricbeat config. Maybe I didnt provide something I didnt consider important:
---
apiVersion: beat.k8s.elastic.co/v1beta1
kind: Beat
metadata:
name: metricbeat
spec:
type: metricbeat
version: 8.6.2
elasticsearchRef:
name: elasticsearch
kibanaRef:
name: kibana
config:
metricbeat:
autodiscover:
providers:
- hints:
default_config: {}
enabled: "true"
node: ${NODE_NAME}
type: kubernetes
modules:
- module: system
period: 10s
metricsets:
- cpu
- load
- memory
- network
- process
- process_summary
processes: ['.*']
process:
include_top_n:
by_cpu: 5
by_memory: 5
- module: system
period: 1m
metricsets:
- filesystem
- fsstat
- uptime
processors:
- drop_event:
when:
regexp:
system:
filesystem:
mount_point: ^/(sys|cgroup|proc|dev|etc|host|lib)($|/)
- module: kubernetes
period: 10s
node: ${NODE_NAME}
hosts:
- https://${NODE_NAME}:10250
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
ssl:
verification_mode: none
metricsets:
- node
- system
- pod
- container
- volume
processors:
- add_cloud_metadata: {}
- add_host_metadata: {}
- add_fields:
fields:
cliente: "MyClient"
daemonSet:
podTemplate:
spec:
serviceAccountName: metricbeat
automountServiceAccountToken: true # some older Beat versions are depending on this settings presence in k8s context
containers:
- args:
- -e
- -c
- /etc/beat.yml
- -system.hostfs=/hostfs
name: metricbeat
volumeMounts:
- mountPath: /hostfs/sys/fs/cgroup
name: cgroup
- mountPath: /var/run/docker.sock
name: dockersock
- mountPath: /hostfs/proc
name: proc
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true # Allows to provide richer host metadata
securityContext:
runAsUser: 0
terminationGracePeriodSeconds: 30
volumes:
- hostPath:
path: /sys/fs/cgroup
name: cgroup
- hostPath:
path: /var/run/docker.sock
name: dockersock
- hostPath:
path: /proc
name: proc
---
# permissions needed for metricbeat
# source: https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-kubernetes.html
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: metricbeat
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
- nonResourceURLs:
- /metrics
verbs:
- get
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: metricbeat
namespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: metricbeat
subjects:
- kind: ServiceAccount
name: metricbeat
namespace: monitoring
roleRef:
kind: ClusterRole
name: metricbeat
apiGroup: rbac.authorization.k8s.io
Could it be something to do with my kubernetes config?
Thank you again
Carlos_T
(Carlos T)
June 18, 2023, 4:38pm
4
Hi all again!
I've just used the same deployment in my house lab environment with k3s as kubernetes cluster with a master and a worker node.
It worked perfectly well. So I guess this is something to do with my cluster's settings. I will ask to my colleagues who installed to check if they have a clue.
Thank you very much all anyway
Thanks a lot Stephen
Carlos T.
1 Like
out of pure curiosity, did you enable capturing cluster metrics using elastic k8s integration with ksm?
Carlos_T
(Carlos T)
June 27, 2023, 11:54am
6
Hi Sunile.
No, I havent enabled that.
Regards.
My .02 (opinion) if you are trying to fetch host and/or pod level metrics, leverage KSM + Elastic KSM integration.
Carlos_T
(Carlos T)
June 30, 2023, 12:24pm
8
Not the case, thank you Sunile.
I've used the options provided in the AllInOne.yaml file found in the samples section of the ECK oficial website.
system
(system)
Closed
July 28, 2023, 12:24pm
9
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.