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

[Helm] Enable leader election by default for Fleet Managed agent installation with perNode preset #6284

Closed
eedugon opened this issue Dec 11, 2024 · 7 comments · Fixed by #6345
Assignees
Labels
bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team

Comments

@eedugon
Copy link
Contributor

eedugon commented Dec 11, 2024

When following the instructions at https://www.elastic.co/guide/en/fleet/current/example-kubernetes-fleet-managed-agent-helm.html and installing a Fleet Managed with preset perNode with something like:

helm install demo ./deploy/helm/elastic-agent \
--set agent.fleet.enabled=true \
--set agent.fleet.url=https://fleet-svc.default.svc \
--set agent.fleet.token=myToken \
--set agent.fleet.preset=perNode \
--set agent.fleet.insecure=true

We get the following agent.yml generated in a secret:

  agent.yml: |-
    fleet:
      enabled: true
    providers:
      kubernetes:
        node: ${NODE_NAME}
        scope: node
      kubernetes_leaderelection:
        enabled: false
        leader_lease: demo-pernode

If the helm chart disables the leader election then we shouldn't continue with the documentation instructions as the kubernetes integration default settings are intended for agents with the leader mechanism enabled.

I suggest to keep leader election enabled for this use case: fleet.enabled=true and fleet.preset=perNode

Of course the user could disable leaderElection if not needed / wanted.

cc: @pkoutsovasilis

@eedugon eedugon added the bug Something isn't working label Dec 11, 2024
@eedugon eedugon changed the title [helm chart] Enable leader election by default for Fleet Managed agent installation with perNode preset [Helm] Enable leader election by default for Fleet Managed agent installation with perNode preset Dec 11, 2024
@eedugon eedugon added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Dec 11, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@strawgate
Copy link
Contributor

strawgate commented Dec 13, 2024

In this case, do we need to touch the providers configuration at all?

    providers:
      kubernetes:
        node: ${NODE_NAME}
        scope: node
      kubernetes_leaderelection:
        enabled: false
        leader_lease: demo-pernode

Wouldn't leader election and the k8s provider be enabled by the Kubernetes integration if it was in the agent policy?

@eedugon
Copy link
Contributor Author

eedugon commented Dec 13, 2024 via email

@strawgate
Copy link
Contributor

Is the part about provider enablement still true with #6169 having been merged?

@eedugon
Copy link
Contributor Author

eedugon commented Dec 14, 2024 via email

@pkoutsovasilis
Copy link
Contributor

@blakerouse please help us here; With this PR merged does it mean that even if we pass at the agent a providers config like the one below

...
providers:
  kubernetes_leaderelection:
    enabled: true
...

when we don't have an input with a condition like the one below

condition: '${kubernetes_leaderelection.leader} == true'

the agent won't try to acquire a lease?

@pkoutsovasilis
Copy link
Contributor

ok I tested this out and I can confirm that a lease is created only when there ${kubernetes_leaderelection.leader} in the agent config. Amazing stuff 🙂 Then this is already resolved for 8.17.x agent versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants