-
Notifications
You must be signed in to change notification settings - Fork 148
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
[Kubernetes] Add kustomize template for hints auto discover #5643
[Kubernetes] Add kustomize template for hints auto discover #5643
Conversation
This pull request does not have a backport label. Could you fix it @MichaelKatsoulis? 🙏
|
|
deploy/kubernetes/elastic-agent-kustomize/ksm-hints/elastic-agent-standalone/kustomization.yaml
Outdated
Show resolved
Hide resolved
deploy/kubernetes/elastic-agent-kustomize/ksm-hints/elastic-agent-standalone/kustomization.yaml
Outdated
Show resolved
Hide resolved
runAsUser: 0 | ||
volumeMounts: | ||
- name: elastic-agent-state | ||
mountPath: /usr/share/elastic-agent/state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you extend the integration k8s tests by adding a new one with hints enabled? it would be nice to check that the agent and all components are starting and reporting healthy with this feature enabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which tests are you referring to Panos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you !! I wanted to double check as we dont actually own them.
But I created an issue here: #5660. We can discuss internally for prioritisation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT the k8s ownership is shared, and the agent repo now has k8s integration tests. So ideally anything that has to do with different k8s deployments should be covered by a test but sure discuss #5660 and try to couple this integration test with this PR
I'm not sure I fully understand the intent of this PR, but shouldn't we also be modifying https://github.com/elastic/elastic-agent/blob/main/deploy/kubernetes/elastic-agent-standalone-kubernetes.yaml? |
@swiatekm no the main standalone manifest should not be affected The users should run a command like the following and make an installation of agent+k8s integration+system integration+kube-state-metrics up and running: kubectl kustomize https://github.com/MichaelKatsoulis/elastic-agent/deploy/kubernetes/elastic-agent-kustomize/ksm-hints/elastic-agent-standalone\?ref\=kustomize_templates_hints_autodiscover | sed -e "s/JUFQSV9LRVkl/UTWamNtcGFkdz09/g" -e "s/%ES_HOST%/https:\/\/e56ee37c53644df6940a8ae217ab5960.us-central1.gcp.cloud.es.io:443/g" -e "s/%CA_TRUSTED%/ca_trusted_fingerprint/g" -e "s/%ONBOARDING_ID%/12345/g" | kubectl apply -f Please read some more info here |
Tested successfully the PR with a current Elastic Cloud setup. Prereq: Go to Stack Management > API Keys and create a new key Important use the beats format key Create the encoded value by running: echo -n oB1lTZIBdpMiLQUgtFM4:Z1bs7_ufTuOj5O8pg0Sxmg | base64
b0IxbFRaSUJkcE1pTFFVZ3RGTTQ6WjFiczdfdWZUdU9qNU84cGcwU3htZw== Then run the following: kubectl kustomize https://github.com/MichaelKatsoulis/elastic-agent/deploy/kubernetes/elastic-agent-kustomize/ksm-hints/elastic-agent-standalone\?ref\=kustomize_templates_hints_autodiscover | sed -e "s/JUFQSV9LRVkl/b0IxbFRaSUJkcE1pTFFVZ3RGTTQ6WjFiczdfdWZUdU9qNU84cGcwU3htZw==/g" -e "s/%ES_HOST%/https:\/\/<CloudURL>:443/g" -e "/{CA_TRUSTED}/c\ " > k2.yaml Replace the image referneces: Then run Metrics and logs collection is successfull. I will run some more tests with autodiscovery templates and annotations in pods. |
Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane) |
@gizas and @pkoutsovasilis could you please review this PR again after latest changes ? |
kind: feature | ||
|
||
# Change summary; a 80ish characters long description of the change. | ||
summary: Provide a Kustomize template which enables hints based autodiscovery by default when deploying standalone elastic-agent into a Kubernetes cluster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Updates the mount path of autodiscovery init container to /etc/elastic-agent/inputs.d in order to eliminate root access needs
To add sth like that in the reasoning as well
LGTM Mike! Great work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! For the future I strongly recommend to extent the agent k8s integration tests to include testing these templates (tracked by this issue #5660)
…ichaelKatsoulis/elastic-agent into kustomize_templates_hints_autodiscover
Quality Gate passedIssues Measures |
* Add template for hints * Create fragment * fixing comments for provider * removing container_logs * Remove root capabilites from initcontainer * Update kustomize patches for hints * Update changelog fragment * Update configmap for standalone agent --------- Co-authored-by: Andrew Gizas <[email protected]> (cherry picked from commit eedce01) # Conflicts: # deploy/kubernetes/elastic-agent-kustomize/default/elastic-agent-standalone/base/elastic-agent-standalone-daemonset.yaml # deploy/kubernetes/elastic-agent-kustomize/ksm-autosharding/elastic-agent-standalone/base/elastic-agent-standalone-daemonset.yaml # deploy/kubernetes/elastic-agent-kustomize/ksm-autosharding/elastic-agent-standalone/extra/elastic-agent-standalone-statefulset.yaml # deploy/kubernetes/elastic-agent-standalone-kubernetes.yaml
…uto discover (#5772) * [Kubernetes] Add kustomize template for hints auto discover (#5643) * Add template for hints * Create fragment * fixing comments for provider * removing container_logs * Remove root capabilites from initcontainer * Update kustomize patches for hints * Update changelog fragment * Update configmap for standalone agent --------- Co-authored-by: Andrew Gizas <[email protected]> (cherry picked from commit eedce01) # Conflicts: # deploy/kubernetes/elastic-agent-kustomize/default/elastic-agent-standalone/base/elastic-agent-standalone-daemonset.yaml # deploy/kubernetes/elastic-agent-kustomize/ksm-autosharding/elastic-agent-standalone/base/elastic-agent-standalone-daemonset.yaml # deploy/kubernetes/elastic-agent-kustomize/ksm-autosharding/elastic-agent-standalone/extra/elastic-agent-standalone-statefulset.yaml # deploy/kubernetes/elastic-agent-standalone-kubernetes.yaml * Fix conflicts --------- Co-authored-by: Michael Katsoulis <[email protected]>
What does this PR do?
This PR
It adds a init container block in elastic agent daemonset.
For all the rest resources needed for the deployment of elastic agent it relies on the resources from the default kustomize templates.
Why is it important?
To enable users of the Observability Kubernetes quickstart to make use of hints auto discovery without the need of configuring and redeploying their manifests.
Checklist
./changelog/fragments
using the changelog toolDisruptive User Impact
How to test this PR locally
Follow instructions of https://github.com/elastic/elastic-agent/tree/main/deploy/kubernetes/elastic-agent-kustomize/default#remote-usage-of-kustomize-templates
Use https://github.com/MichaelKatsoulis/elastic-agent/deploy/kubernetes/elastic-agent-kustomize/ksm-hints/elastic-agent-standalone\?ref\=kustomize_templates_hints_autodiscover for the kustomization file link.
Related issues