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

[docs] Config Walkthroughs and FAQs #95

Merged
merged 5 commits into from
Aug 24, 2018
Merged

Conversation

DirectXMan12
Copy link
Contributor

This adds a more hands-on configuration example, plus a few FAQs.

The config docs had a find/replace error in the naming section, leading
to an erroneus `as` clause.  This fixes that.
@DirectXMan12
Copy link
Contributor Author

DirectXMan12 commented Aug 7, 2018

Thanks to @aabed and @atomaras for rightly pointing out that configuration
and labeling needed a bit more documentation!

@atomaras
Copy link

atomaras commented Aug 7, 2018

I like it!
One suggestion would be to give a more prominent position to the HPA in the walkthrough.
As a user this is my initial viewpoint and my ultimate goal.
What should my HPA yaml look like for it to actually work with custom metrics?
Then I would say that this HPA yaml will translate to hpa controller making this rest call to figure out the metric i.e $KUBERNETES/apis/custom.metrics.k8s.io/v1beta1/namespaces/production/pods/*/http_requests_per_second

Then I would jump into how custom metrics can be configured to expose this exact URL for HPA to be happy.
This HPA intro (goal first approach) will give readers all the context they need to be able to follow along and understand why we do all these complex configurations.

README.md Outdated
and more information about configuring the adapter in the [docs](/docs/config.md).

Next, check if the discovery information looks right. You should see the metrics showing
up as associated with the resources you expect at. `/apis/custom.metrics.k8s.io/v1beta1/`.

Choose a reason for hiding this comment

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

This could maybe be kubectl get --raw /apis/custom.metrics.k8s.io/v1beta1 | jq .

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, at least it should mention kubectl get --raw somewhere here.

- seriesQuery: 'http_requests_total{kubernetes_namespace!="",kubernetes_pod_name!=""}'
resources:
overrides:
kubernetes_namespace: {resource: "namespace"}

Choose a reason for hiding this comment

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

Is there somewhere that lists the available resource types? It might be good to include a link to that around this section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a command, but it can change at any time due to CRDs, aggregated API servers, etc. I'll add a note about it.

kubernetes_pod_name: {resource: "pod"}
```

This says that each label represents its corresponding reosurce. Since the

Choose a reason for hiding this comment

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

typo: reosurce

Since we're only working with a single metric anyway, we could replace
`<<.Series>>` with `http_requests_total`.

Now, if we put run an instance of the Prometheus adapter with this

Choose a reason for hiding this comment

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

if we put run

the adapter for your particular metrics and labels.
the adapter for your particular metrics and labels. The [configuration
walkthrough](/docs/config-walkthrough.md) gives an end-to-end
configuration tutorial for configure the adapter for a scenario similar to

Choose a reason for hiding this comment

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

for configuring

### Quantity Values

Notice that the API uses Kubernetes-style quantities to describe metric
values. These quantities use SI suffixes instead of decimal points. The

Choose a reason for hiding this comment

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

There are two spaces after some periods here

@DirectXMan12 DirectXMan12 force-pushed the docs/common-issues branch 2 times, most recently from 5485817 to 4579fc9 Compare August 8, 2018 21:14
README.md Outdated

First, check your configuration. Does it select your metric? You can find the
[default configuration](/deploy/custom-metrics-config-map.yaml) in the deploy directory,
and more information about configuring the adapter in the [docs](/docs/config.md).
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be helpful to have a command to return all metrics. Not only the registered metric names but the actual per pod/object metrics. That would help to validate this.

Choose a reason for hiding this comment

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

I agree. I'm currently struggling with the config and was hoping there's an easy way to list what it can "see".

Copy link

@itskingori itskingori Aug 21, 2018

Choose a reason for hiding this comment

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

Ah, never mind ... found what I was looking for in https://github.com/DirectXMan12/k8s-prometheus-adapter/pull/95/files#r208729936.

Copy link
Contributor

Choose a reason for hiding this comment

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

This only shows what metrics it knows about but you still might not have a metric with the right labels for a particular HPA. In that case it would be useful to have a expression that also returns the per-object/pod metrics.

Choose a reason for hiding this comment

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

Yeah, initially I came to the same conclusion eventually. 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

can you file a separate issue for that?

@discordianfish
Copy link
Contributor

Great, that will help a lot!

I'd also add some words around using object vs pod metrics. Another thing I haven't figured out (not needing it right now) is how to make the HPA scale down of a metric goes up.

whichever metrics you want in the `metricsQuery`! The series query can contain
whichever metrics you want, as long as they have the right set of labels.

For example, if you have two metrics `foo_total` and `foo_count`, you might write

Choose a reason for hiding this comment

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

It could be useful for clarity to say that foo_total has the label system_name which represents the actual node

@DirectXMan12
Copy link
Contributor Author

TODO: for me: make sure to add an FAQ entry about flickering metrics

@itskingori
Copy link

itskingori commented Aug 21, 2018

@DirectXMan12 This is really great, make the configuration clearer. Thank you! 🏆

A helful community member rightly pointed out that configuring the
adapter was a bit confusing, and a step-by-step example would be useful.
This adds such an example, and links to it from relevant places.
Quantities continue to confuse people, so adding concrete examples
should help.
This adds some FAQs to the README containing information about certs,
labelling, configuration, quantities, and multiple metrics.
This restructures the walkthrough to focus on the goal of scaling an
application from the start.  We start out with an application and an
autoscaler, and then walk through how we can make the autoscaler
actually able to function.
@DirectXMan12 DirectXMan12 merged commit b755cf7 into master Aug 24, 2018
@DirectXMan12 DirectXMan12 deleted the docs/common-issues branch August 24, 2018 15:21
simonpasquier pushed a commit to simonpasquier/k8s-prometheus-adapter that referenced this pull request Dec 8, 2023
…ncy-openshift-4.15-ose-prometheus-adapter

OCPBUGS-24155: Updating ose-prometheus-adapter-container image to be consistent with ART
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.

5 participants