Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use elastic-agent status as healthcheck #329

Merged
merged 11 commits into from
Apr 27, 2021
8 changes: 4 additions & 4 deletions internal/install/static_kubernetes_elastic_agent_yml.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ spec:
value: "1"
- name: FLEET_URL
value: "http://fleet-server:8220"
- name: STATE_PATH
value: /usr/share/elastic-agent
- name: NODE_NAME
valueFrom:
fieldRef:
Expand All @@ -55,10 +57,8 @@ spec:
startupProbe:
exec:
command:
- sh
- -c
- grep "Agent is starting" -r . --include=elastic-agent-json.log

- elastic-agent
- status
---
apiVersion: v1
kind: ConfigMap
Expand Down
3 changes: 2 additions & 1 deletion internal/install/static_snapshot_yml.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,15 @@ services:
fleet-server:
condition: service_healthy
healthcheck:
test: "sh -c 'grep \"Agent is starting\" -r . --include=elastic-agent-json.log'"
test: "elastic-agent status"
retries: 90
interval: 1s
hostname: docker-fleet-agent
environment:
- "FLEET_ENROLL=1"
- "FLEET_INSECURE=1"
- "FLEET_URL=http://fleet-server:8220"
- "STATE_PATH=/usr/share/elastic-agent"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we change it for both fleet-server and elastic-agent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try and change it, but previously it didn't work well (maybe it was the STATE_PATH issue). I will re-check it :)

Copy link
Contributor Author

@mtojek mtojek Apr 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the fleet-server section to use "elastic-package status". Let's see.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you setting the STATE_PATH? The /usr/share/elastic-agent/state is the default, why not use that? Is this a workaround for the status command not working.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blakerouse Yes, otherwise the status command does not work as it does it looks into the wrong path.

volumes:
- type: bind
source: ../tmp/service_logs/
Expand Down