Skip to content

Commit

Permalink
Add cap_net_raw requirements to heartbeat docs (#32816)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilioalvap authored and chrisberkhout committed Jun 1, 2023
1 parent 0236b5e commit 98fe462
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
12 changes: 12 additions & 0 deletions heartbeat/docs/running-on-docker.asciidoc
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
include::{libbeat-dir}/shared-docker.asciidoc[]

[float]
==== Required network capabilities

Under Docker, {beatname_uc} runs as a non-root user, but requires some privileged
network capabilities to operate correctly. Ensure that the +NET_RAW+
capability is available to the container.

["source","sh",subs="attributes"]
----
docker run --cap-add=NET_RAW {dockerimage}
----
19 changes: 19 additions & 0 deletions heartbeat/docs/running-on-kubernetes.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,22 @@ $ kubectl --namespace=kube-system get deployment/{beatname_lc}
NAME READY UP-TO-DATE AVAILABLE AGE
{beatname_lc} 1/1 1 1 1m
------------------------------------------------

[float]
==== Running {beatname_uc} as unprivileged user

Under Kubernetes, {beatname_uc} can run as a non-root user, but requires some privileged
network capabilities to operate correctly. Ensure that the +NET_RAW+
capability is available to the container.

["source","yaml",subs="attributes"]
----
containers:
- name: heartbeat
image: {dockerimage}
securityContext:
runAsUser: 1000
runAsGroup: 1000
capabilities:
add: [ NET_RAW ]
----
2 changes: 2 additions & 0 deletions libbeat/docs/shared-docker.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ ifeval::["{beatname_lc}"=="heartbeat"]
["source", "sh", subs="attributes"]
--------------------------------------------
docker run \
--cap-add=NET_RAW \
{dockerimage} \
setup -E setup.kibana.host=kibana:5601 \
-E output.elasticsearch.hosts=["elasticsearch:9200"] <1> <2>
Expand Down Expand Up @@ -206,6 +207,7 @@ docker run -d \
--name={beatname_lc} \
--user={beatname_lc} \
--volume="$(pwd)/{beatname_lc}.docker.yml:/usr/share/{beatname_lc}/{beatname_lc}.yml:ro" \
--cap-add=NET_RAW \
{dockerimage} \
--strict.perms=false -e \
-E output.elasticsearch.hosts=["elasticsearch:9200"] <1> <2>
Expand Down

0 comments on commit 98fe462

Please sign in to comment.