Skip to content

Commit

Permalink
Use hostNetwork for Metricbeat Deployment
Browse files Browse the repository at this point in the history
Metricbeat k8s deployment is used to  poll the kube-state-metrics service
for the kubernetes metricset. This configuration results in the metricbeat pod
being reported as a host i.e. beat.name becomes the container name on
all docs. This can be confusing in some visualizations.

With this change the Metricbeat will report the underlying hostname.

Fixes elastic#7199
  • Loading branch information
Carlos Pérez-Aradros Herce committed Jun 28, 2018
1 parent c597519 commit 25928c6
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ https://github.com/elastic/beats/compare/v6.2.3...master[Check the HEAD diff]
- Fix field mapping for the system process CPU ticks fields. {pull}7230[7230]
- Fix Windows service metricset when using a 32-bit binary on a 64-bit OS. {pull}7294[7294]
- Fix Jolokia attribute mapping when using wildcards and MBean names with multiple properties. {pull}7321[7321]
- Do not report Metricbeat container host as hostname in Kubernetes deployment. {issue}7199[7199]

*Packetbeat*

Expand Down
10 changes: 2 additions & 8 deletions deploy/kubernetes/metricbeat-kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,6 @@ spec:
value:
- name: ELASTIC_CLOUD_AUTH
value:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
runAsUser: 0
resources:
Expand Down Expand Up @@ -198,6 +194,8 @@ spec:
k8s-app: metricbeat
spec:
serviceAccountName: metricbeat
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: metricbeat
image: docker.elastic.co/beats/metricbeat:7.0.0-alpha1
Expand All @@ -218,10 +216,6 @@ spec:
value:
- name: ELASTIC_CLOUD_AUTH
value:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
runAsUser: 0
resources:
Expand Down
4 changes: 0 additions & 4 deletions deploy/kubernetes/metricbeat/metricbeat-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ spec:
value:
- name: ELASTIC_CLOUD_AUTH
value:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
runAsUser: 0
resources:
Expand Down
6 changes: 2 additions & 4 deletions deploy/kubernetes/metricbeat/metricbeat-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ spec:
k8s-app: metricbeat
spec:
serviceAccountName: metricbeat
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: metricbeat
image: docker.elastic.co/beats/metricbeat:%VERSION%
Expand All @@ -33,10 +35,6 @@ spec:
value:
- name: ELASTIC_CLOUD_AUTH
value:
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
runAsUser: 0
resources:
Expand Down

0 comments on commit 25928c6

Please sign in to comment.