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

Elastic agent on k8s #19727

Merged
merged 6 commits into from
Jul 28, 2020
Merged

Elastic agent on k8s #19727

merged 6 commits into from
Jul 28, 2020

Conversation

ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Jul 8, 2020

What does this PR do?

Add manifests and docs regarding running Agent on k8s.

Why is it important?

It's a suggested way to run Agent on k8s environments in oder to deploy Kubernetes Package (elastic/integrations#70) efficiently.

cc: @exekias

Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark ChrsMark added Team:Platforms Label for the Integrations - Platforms team Team:Ingest Management labels Jul 8, 2020
@ChrsMark ChrsMark self-assigned this Jul 8, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-platforms (Team:Platforms)

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 8, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 8, 2020
Signed-off-by: chrismark <chrismarkou92@gmail.com>
@elasticmachine
Copy link
Collaborator

elasticmachine commented Jul 8, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #19727 updated]

  • Start Time: 2020-07-23T13:32:07.387+0000

  • Duration: 57 min 16 sec


ifeval::["{release-state}"=="unreleased"]

However, version {version} of {agent} has not yet been
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd delete this paragraph or we may risk to forget about it in the near future. In other words, docs shouldn't "warn" or "announce" future updates or changes

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we are covered by the ifeval::["{release-state}"=="unreleased"] :)
The same we do also in manifests for x-Beats too: https://github.com/elastic/beats/blame/master/metricbeat/docs/running-on-kubernetes.asciidoc#L9

Copy link
Contributor

@sayden sayden left a comment

Choose a reason for hiding this comment

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

LGTM but I'd remove that paragraph I mentioned

Signed-off-by: chrismark <chrismarkou92@gmail.com>
Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ruflin
Copy link
Member

ruflin commented Jul 23, 2020

Note: The points below should not block this PR.

@exekias Is this just a "recommendation" or our "supported" way or running the agent on k8s?
@ph We should probably also have a follow up discussion on who owns updating these manifests?

image: docker.elastic.co/beats/elastic-agent:8.0.0-SNAPSHOT
command: ["/bin/sh", "-c"]
args: [
"yes | ./elastic-agent enroll $KIBANA_HOST $FLEET_ENROLLMENT_TOKEN && ./elastic-agent run"
Copy link
Contributor

Choose a reason for hiding this comment

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

uhm I wonder if this should be handled by the agent image itself. What will happen here when we are already enrolled but get a pod recreation?

Copy link
Contributor

@exekias exekias left a comment

Choose a reason for hiding this comment

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

I saw the last change in the run command, let's discuss that before merging

@exekias
Copy link
Contributor

exekias commented Jul 23, 2020

Note: The points below should not block this PR.

@exekias Is this just a "recommendation" or our "supported" way or running the agent on k8s?

This should be the supported way of running the agent, in many cases you can expect some user tweaks. In any case, as of now It feels more like a first stab at it, we should keep iterating over this story and make it sound for GA

@ChrsMark
Copy link
Member Author

I saw the last change in the run command, let's discuss that before merging

This change performs the same commands with what docker-entrypoint performs: https://github.com/elastic/beats/blob/master/dev-tools/packaging/templates/docker/docker-entrypoint.elastic-agent.tmpl

  1. enroll:
    ./{{ .BeatName }} enroll ${KIBANA_HOST:-http://localhost:5601} $apikey -f
  2. start:

This was used to work with master versions because of https://github.com/elastic/beats/pull/18445/files#diff-4847a986cf06ab4d26f26f5212720eedR52. However the respective PR was not backported to 7.9 (see

apikey=$(echo $enrollResp | jq -r '.item.api_key')
) and hence the startup script was failing cause the apikey was always overwritten.

I agree we should not patch the startup command of the container with custom one. I will open a PR with this small change for 7.9.

@ChrsMark ChrsMark mentioned this pull request Jul 23, 2020
Signed-off-by: chrismark <chrismarkou92@gmail.com>
@ChrsMark
Copy link
Member Author

Tested the manifests e2e with a fresh 7.9 docker image. Previous issue resolved, merging this one.

@ChrsMark ChrsMark merged commit 9f99091 into elastic:master Jul 28, 2020
ChrsMark added a commit to ChrsMark/beats that referenced this pull request Jul 28, 2020
(cherry picked from commit 9f99091)
ChrsMark added a commit to ChrsMark/beats that referenced this pull request Jul 28, 2020
(cherry picked from commit 9f99091)
ChrsMark added a commit that referenced this pull request Jul 28, 2020
ChrsMark added a commit that referenced this pull request Jul 28, 2020
v1v added a commit to v1v/beats that referenced this pull request Jul 29, 2020
* upstream/7.9: (32 commits)
  feat(ci): support storing artifacts for PRs in separate dirs (elastic#20282) (elastic#20301)
  Cisco ASA: Fix message 106100 (elastic#20245) (elastic#20277)
  [CI] Change upstream reference (elastic#20296) (elastic#20297)
  [docs] Fix Windows download link for agent (elastic#20258) (elastic#20290)
  Cherry-pick to 7.9: [docs] Rename release highlights to what's new (elastic#20255) (elastic#20285)
  Elastic agent on k8s (elastic#19727) (elastic#20262)
  [Filebeat Module] Defender ATP - Adding dashboard (elastic#20058) (elastic#20093)
  fix: use a fixed worker type for tests (elastic#20130) (elastic#20247)
  [Elastic Agent] Fix Windows powershell install service script (elastic#20203) (elastic#20252)
  [Ingest Manager] Fixed unzip on older windows  (elastic#20088) (elastic#20109)
  adding possibility to override content-type checks, it was breaking certain webhooks that is not able to set content-headers at all. Still defaults to application/json (elastic#20232) (elastic#20237)
  [Filebeat][Gsuite] Make GSuite docs more clear (elastic#19981) (elastic#20067)
  Increase index.max_docvalue_fields_search to 200 (elastic#20218) (elastic#20221)
  Call host parser only once when building light metricsets (elastic#20149) (elastic#20190)
  [Metricbeat] Use MySQL Host Parser in Query metricset (elastic#20191) (elastic#20212)
  [Filebeat] Ignore cylance.protect timestamps while testing (elastic#20207) (elastic#20217)
  [libbeat] Fix write error in ensureWriter.Write (elastic#20112) (elastic#20145)
  Cherry-pick elastic#20127 to 7.9: Fix failing unit tests on windows  (elastic#20180)
  Remove f5/firepass rsa2elk fileset (elastic#20160) (elastic#20206)
  Cherry-pick elastic#20138 to 7.9: [Filebeat] Update crowdstrike module (elastic#20177)
  ...
melchiormoulin pushed a commit to melchiormoulin/beats that referenced this pull request Oct 14, 2020
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Platforms Label for the Integrations - Platforms team v7.9.0 v7.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants