Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

[metricbeat] Remove default kube static metrics host to avoid co… #289

Merged
merged 1 commit into from
Sep 19, 2019

Conversation

Crazybus
Copy link
Contributor

@Crazybus Crazybus commented Sep 18, 2019

This default value is never used since the environment variable is
always being set for the deployment. See
#283 (comment)
for more information.

  • Chart version not bumped (the versions are all bumped and released at the same time)
  • README.md updated with any new values or changes
  • Updated template tests in ${CHART}/tests/*.py
  • Updated integration tests in ${CHART}/examples/*/test/goss.yaml

This default value is never used since the environment variable is
always being set for the deployment. See
#283 (comment)
for more information.
@Crazybus Crazybus requested a review from jmlrt September 18, 2019 14:27
Copy link
Member

@jmlrt jmlrt 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 don't understand wher are we retriving the value of $({{ .Release.Name | replace "-" "_" | upper }}_KUBE_STATE_METRICS_SERVICE_HOST):$({{ .Release.Name | replace "-" "_" | upper }}_KUBE_STATE_METRICS_SERVICE_PORT_HTTP) in metricbeat/templates/deployment.yaml#L95

@Crazybus
Copy link
Contributor Author

Kube state metrics is installed as a child chart (https://github.com/elastic/helm-charts/blob/master/metricbeat/requirements.yaml) which is used to scrape the Kubernetes API metrics for metricsbeat. Does that explain why you can't see where the kube state metrics service is defined? Or did you mean something else?

@Crazybus Crazybus changed the title [metricbeat] Remove default kube static metrics host to avoid confusion [metricbeat] Remove default kube static metrics host to avoid co… Sep 19, 2019
@Crazybus Crazybus merged commit 5306553 into master Sep 19, 2019
@Crazybus Crazybus deleted the default_me_not branch September 19, 2019 09:33
@jmlrt
Copy link
Member

jmlrt commented Sep 19, 2019

Kube state metrics is installed as a child chart (https://github.com/elastic/helm-charts/blob/master/metricbeat/requirements.yaml)

Thanks I didn't check requirements.yaml.

Or did you mean something else?

Well as I understand the line value: "$({{ .Release.Name | replace "-" "_" | upper }}_KUBE_STATE_METRICS_SERVICE_HOST):$({{ .Release.Name | replace "-" "_" | upper }}_KUBE_STATE_METRICS_SERVICE_PORT_HTTP)", Assuming that the release name is metricbeat, KUBE_STATE_METRICS_HOSTS environment variable is set to a concatenation of the value of $METRICBEAT_KUBE_STATE_METRICS_SERVICE_HOST environment variable and the value of $METRICBEAT_KUBE_STATE_METRICS_SERVICE_PORT_HTTP environment variable (with :between them).

However, I don't find in this Charts or in kube-state-metric Charts where $METRICBEAT_KUBE_STATE_METRICS_SERVICE_HOST and $METRICBEAT_KUBE_STATE_METRICS_SERVICE_PORT_HTTP environment variables are defined.

Did I miss or misunderstood something?

@Crazybus
Copy link
Contributor Author

Ahh I get ya now. Kubernetes automatically creates these environment variables for all pods running in the namespace pointing to the service. So if there is a service called metricbeat-kube-state-metrics there will be an environment variable inside all pods in that namespace called METRICBEAT_KUBE_STATE_METRICS_SERVICE_HOST and METRICBEAT_KUBE_STATE_METRICS_SERVICE_PORT_HTTP

The reason that we use the environment variable instead of the service name in the config is that the service name is hardcoded in the default values. I think we could add go templating logic in values.yaml but this felt like the cleaner option because it means that all users can just refer to KUBE_STATE_METRICS_HOSTS in their metricbeat config without needing to copy paste the templating logic.

@jmlrt
Copy link
Member

jmlrt commented Sep 19, 2019

OK now I understand, I forgot that Kubernetes was automatically setting these environment variables.
Thanks for the reminder.

@iahmad-khan
Copy link

Hi,

Is there a way to use metrics-server instead of kube-state-metrics.

thanks

@Crazybus
Copy link
Contributor Author

Not that I know of. As far as I can tell Metricbeat only supports collecting the state_* metricsets from kube-state-metrics:

https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-kubernetes.html

https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-kubernetes.html

If you would like this to be possible it would need to be a feature requests in https://github.com/elastic/beats. Since this repository is just the Helm chart installing Metricbeat.

@iahmad-khan
Copy link

@Crazybus Thanks. I am asking this becuase kubernetes installations are coming with metrics-server by default ( at least the one i installed using RKE ). So it will make sense if they support the one with default instead of adding another one just for metricbeat.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants