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

Fix AD KSM port choice #1308

Merged
merged 1 commit into from
Mar 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion kubernetes_state/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# CHANGELOG - kubernetes_state

2.4.0 / unrelease
2.4.1 / Unreleased
==================

* [BUGFIX] [Fix the chosen port](https://github.com/DataDog/datadog-agent/issues/1523) in recent KSM versions exposing multiple ports

2.4.0 / 2018-03-23
==================

* [IMPROVEMENT] Add kubernetes_state.nodes.by_condition count metric [#1277][]
Expand Down
2 changes: 1 addition & 1 deletion kubernetes_state/auto_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ init_config:

instances:
# To enable Kube State metrics you must specify the url exposing the API
- kube_state_url: http://%%host%%:%%port%%/metrics
- kube_state_url: http://%%host%%:8080/metrics
Copy link
Contributor

@pdecat pdecat Apr 4, 2018

Choose a reason for hiding this comment

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

It would have probably been better to use %%port_0%% instead of a hard-coded value here.

DataDog/datadog-agent#1523 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the initial approach but we decided to go with the hardcoded port because we would have a similar issue if one day KSM exposes a port < 8080

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough. Yet it will also break if someone customizes the value of the http-metrics port on the kube-state-metrics deployment.

It would be awesome if datadog auto discovery would allow specifying ports by their name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pdecat indeed it would be great for kubernetes annotation to support this, adding it to the backlog.

Copy link
Member

Choose a reason for hiding this comment

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

Yet it will also break if someone customizes the value of the http-metrics port on the kube-state-metrics deployment.

That's true, in this case your best bet for now would be to use explicit annotations to override the auto_conf, and hardcode the port you customized in the kube-state-metrics deployment.

Copy link

Choose a reason for hiding this comment

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

@hkaj I'm having a bit of trouble overriding the auto_conf. I have a second container, kube-rbac-proxy, (https://github.com/brancz/kube-rbac-proxy) in my kube-state-metrics deployment that listens on 8443. The container name is kube-rbac-proxy-main. Following the AD datadog docs I tried the below annotations and a few variations of it. The agent always tries to hit port 8080 though :(

    ad.datadoghq.com/kube-rbac-proxy-main.check_names: '["kubernetes_state"]'
    ad.datadoghq.com/kube-rbac-proxy-main.init_configs: '[{}]'
    ad.datadoghq.com/kube-rbac-proxy-main.instances: '[{"kubernetes_state_url": "http://%%host%%:%%port%%/metrics"}]'

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it's because of your usage of kubernetes_state_url instead of kube_state_url.

Copy link

@jdamata jdamata Feb 13, 2019

Choose a reason for hiding this comment

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

Still didn't work. I opted to mount a configmap and overwrite the config manually. I believe theres a bigger block here for me. Kube-rbac-proxy requires the client to authenticate via client TLS or rbac token. I can't find any documentation on how to send the rbac token as a header in the request within datadog. Going to open a new issue for this

#3113

Copy link

@chiefy chiefy May 3, 2019

Choose a reason for hiding this comment

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

I'm having a problem w/ this as well - we're using the prometheus-operator which deploys kube-state-metrics service exposing ports 8443/9443 for https we defintely don't want two deployments of KSM running in our cluster. EDIT: looks like that's actually kube-rbac-proxy.

# Tags are reported as set by kube-state-metrics. If you want to translate
# them to other tags, you can use the labels_mapper dictionary
# labels_mapper:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

KubernetesState = kubernetes_state.KubernetesState

__version__ = "2.4.0"
__version__ = "2.4.1"

__all__ = ['kubernetes_state']
2 changes: 1 addition & 1 deletion kubernetes_state/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"linux",
"mac_os"
],
"version": "2.4.0",
"version": "2.4.1",
"use_omnibus_reqs": true,
"public_title": "Datadog-Kubernetes State Integration",
"categories":["orchestration", "containers"],
Expand Down