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

Allow to run multiple independent agents in kubernetes #1759

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

mrodm
Copy link
Contributor

@mrodm mrodm commented Apr 10, 2024

Relates #787
Follows #1724

Allow to run several independent agents in kubernetes. For that, agent name daemonset (and related resources) have been named adding the Data Stream and agent Run ID as suffixes. All these Elastic Agent are run in the same kube-system namespace.

It could be added each elastic agent in a different namespace. But this would require to update current packages. It would require to update the kube-state-metrics service URL in the test system configuration since they are running in different namespaces. For instance in the test package from this repository, these changes would be required:

diff --git test/packages/with-kind/kubernetes/data_stream/state_cronjob/_dev/test/system/test-default-config.yml test/packages/with-kind/kubernetes/data_stream/state_cronjob/_dev/test/system/test-default-config.yml
index 0f4bd620..ec4b9f3a 100644
--- test/packages/with-kind/kubernetes/data_stream/state_cronjob/_dev/test/system/test-default-config.yml
+++ test/packages/with-kind/kubernetes/data_stream/state_cronjob/_dev/test/system/test-default-config.yml
@@ -3,4 +3,4 @@ data_stream:
   vars:
     hosts:
       # this is the DNS name of the k8s service for kube-state-metrics deployment
-      - http://kube-state-metrics:8080
+      - http://kube-state-metrics.kube-system:8080
diff --git test/packages/with-kind/kubernetes/data_stream/state_pod/_dev/test/system/test-default-config.yml test/packages/with-kind/kubernetes/data_stream/state_pod/_dev/test/system/test-default-config.yml
index 0f4bd620..ec4b9f3a 100644
--- test/packages/with-kind/kubernetes/data_stream/state_pod/_dev/test/system/test-default-config.yml
+++ test/packages/with-kind/kubernetes/data_stream/state_pod/_dev/test/system/test-default-config.yml
@@ -3,4 +3,4 @@ data_stream:
   vars:
     hosts:
       # this is the DNS name of the k8s service for kube-state-metrics deployment
-      - http://kube-state-metrics:8080
+      - http://kube-state-metrics.kube-system:8080

@mrodm mrodm self-assigned this Apr 10, 2024
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @mrodm

@mrodm mrodm changed the title Allow to run multiple kubernetes independent agents Allow to run multiple independent agents in kubernetes Apr 10, 2024
@mrodm mrodm marked this pull request as ready for review April 10, 2024 15:14
@mrodm mrodm requested a review from a team April 10, 2024 15:26
Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

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

LGTM!

It could be added each elastic agent in a different namespace. But this would require to update current packages. It would require to update the kube-state-metrics service URL in the test system configuration since they are running in different namespaces.

I think we could do this in any case, so as you prefer.

@mrodm
Copy link
Contributor Author

mrodm commented Apr 11, 2024

It could be added each elastic agent in a different namespace. But this would require to update current packages. It would require to update the kube-state-metrics service URL in the test system configuration since they are running in different namespaces.

I think we could do this in any case, so as you prefer.

Thanks!
I think I will leave it as it is, since kubernetes package has those URLs (kube-state-metrics:8080) in the system test configuration files. If it is changed the namespace where Elastic Agents are deployed, those configuration files should be updated too.

@mrodm mrodm merged commit 4bd9744 into elastic:main Apr 11, 2024
3 checks passed
@mrodm mrodm deleted the agents_kubernetes_namespaces branch April 11, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants