Open BenB196 opened 3 years ago
Thanks for the bug report. These are indeed conflicting requirements between our ECK CRD and Metricbeat. We need to run Beats as root in order to use hostPath volumes to persist the identity and internal state of your Beats process across restarts of the container. Heartbeat synthetic monitoring however requires you to run as a non-root user.
Given that a stable Beat process identity is less of a concern with Heartbeat IMO (it would be more important with Filebeat for example where ingest state across restarts is relevant) you could use an emptyDir
volume instead and run the process as non-root user as a workaround until we can fix this issue in the product.
deployment:
podTemplate:
spec:
volumes:
- emptyDir: {}
name: beat-data
@andrewvc Pinging you here as I know you have been thinking about this too.
@pebrc Thanks, this workaround worked for getting Heartbeat to start with synthetics enabled.
I've opened https://github.com/elastic/beats/issues/27648 to discuss what our path forward here is. At the very least we need to improve docs.
What would be the workaround for docker in this case? I'm having the same problem with running docker on a windows server. I'm running the container as the heartbeat user not root.
When I remove
spec:
deployment:
podTemplate:
spec:
securityContext:
runAsUser: 0
I am receiving the error message
cp: cannot create regular file '/usr/local/share/ca-certificates/ca.crt': Permission denied
Is there another way to work around this problem?
is this issue ever going to be fixed?
Bug Report
What did you do?
Deploy a synthetic monitor via ECK
What did you expect to see?
Synthetic to be able to start up correctly.
What did you see instead? Under which circumstances?
Ran into two errors:
Workaround error by removing:
Get second, different error: 2.
Environment
ECK version:
1.7.0
Kubernetes information:
v1.20.9+rke2r2
Resource definition:
Logs:
{"level":"error","timestamp":"2021-08-25T18:52:05.809Z","caller":"instance/beat.go:989","message":"Exiting: Beat meta file failed to open: open /usr/share/heartbeat/data/meta.json: permission denied"} Exiting: Beat meta file failed to open: open /usr/share/heartbeat/data/meta.json: permission denied