I want to use the Synthetic Monitoring feature from Elastic.
I have deployed Heartbeat on Kubernetes (manifest: https://raw.githubusercontent.com/elastic/beats/7.15/deploy/kubernetes/heartbeat-kubernetes.yaml) and added heartbeat monitors.
I tried it on a Kubernetes Cluster with version 1.19 on IBM Cloud as well as in Minikube with version 1.19 and there was the same error message on both environments.
The http heartbeat monitor are working fine. But as soon as I use heartbeat.monitors with type browser, I get the following error:
2021-10-15T09:28:23.348Z INFO browser/browser.go:35 Synthetic browser monitor detected! Please note synthetic monitors are a beta feature!
2021-10-15T09:28:23.464Z INFO [monitoring] log/log.go:153 Total non-zero metrics {"monitoring": {"metrics": {"beat":{"cgroup":{"cpu":{"cfs":{"period":{"us":20000}},"id":"fe32ac0c04ec259a6c372e35ac4a45f5915b1092308878bf52d33644ab3c9268"},"cpuacct":{"id":"fe32ac0c04ec259a6c372e35ac4a45f5915b1092308878bf52d33644ab3c9268","total":{"ns":310777387}},"memory":{"id":"fe32ac0c04ec259a6c372e35ac4a45f5915b1092308878bf52d33644ab3c9268","mem":{"limit":{"bytes":209715200},"usage":{"bytes":33722368}}}},"cpu":{"system":{"ticks":60,"time":{"ms":79}},"total":{"ticks":220,"time":{"ms":262},"value":220},"user":{"ticks":160,"time":{"ms":183}}},"handles":{"limit":{"hard":1048576,"soft":1048576},"open":24},"info":{"ephemeral_id":"d5c57419-8096-4e73-8b71-0076bfc5dd63","uptime":{"ms":197},"version":"7.14.1"},"memstats":{"gc_next":8783904,"memory_alloc":5096184,"memory_sys":74793992,"memory_total":16609168,"rss":86163456},"runtime":{"goroutines":50}},"heartbeat":{"browser":{"monitor_stops":1},"http":{"endpoint_starts":10,"monitor_starts":8},"scheduler":{"jobs":{"active":7},"tasks":{"active":7}}},"libbeat":{"config":{"module":{"running":0}},"output":{"events":{"active":0},"type":"elasticsearch"},"pipeline":{"clients":10,"events":{"active":0},"queue":{"max_events":4096}}},"system":{"cpu":{"cores":4},"load":{"1":13.94,"15":13.07,"5":13.7,"norm":{"1":3.485,"15":3.2675,"5":3.425}}}}}}
2021-10-15T09:28:23.466Z INFO [monitoring] log/log.go:154 Uptime: 199.519761ms
2021-10-15T09:28:23.467Z INFO [monitoring] log/log.go:131 Stopping metrics logging.
2021-10-15T09:28:23.468Z INFO instance/beat.go:479 heartbeat stopped.
2021-10-15T09:28:23.468Z ERROR instance/beat.go:989 Exiting: could not create monitor: job err script monitors cannot be run as root! Current UID is 0
Exiting: could not create monitor: job err script monitors cannot be run as root! Current UID is 0
I have used the example from elastic (Quickstart: Synthetic monitoring via Docker | Observability Guide [7.15] | Elastic)
heartbeat.monitors:
- type: browser
id: synthetic-inline-suites
name: Elastic website
schedule: '@every 1m'
source:
inline:
script: |-
step("load homepage", async () => {
await page.goto('https://www.elastic.co');
});
step("hover over products menu", async () => {
await page.hover('css=[data-nav-item=products]');
});
The kubernetes yaml for heartbeat runs as root user, but if I dont run it as root, then the needed files for heartbeat like heartbeat.yml cannot be loaded.
Do I miss something or is there any way to fix this or does it just not work yet for kubernetes?
Thanks and Regards
Ben Stucke