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

Custom metrics support #2652

Closed
23doors opened this issue May 29, 2017 · 8 comments
Closed

Custom metrics support #2652

23doors opened this issue May 29, 2017 · 8 comments

Comments

@23doors
Copy link

23doors commented May 29, 2017

Is there any way to enable 1.6 custom metrics with kops?

As it is specified on: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/

In order to use custom metrics in the Horizontal Pod Autoscaler, you must deploy your cluster with the --horizontal-pod-autoscaler-use-rest-clients flag on the controller manager set to true.

Any way to make this happen with kops? Or is it preferable to edit kube-controller pod directly? Or maybe even install kubeadm after creating cluster?

@23doors 23doors changed the title Custom metrics Custom metrics support May 29, 2017
@chrislovecnm
Copy link
Contributor

We do not have this out of the box. It would need to be added here

https://github.com/kubernetes/kops/blob/master/pkg/apis/kops/componentconfig.go

How to update the apis is in our developer docs if you are interested at all.

@Cisneiros
Copy link

Cisneiros commented Jun 29, 2017

I see there is mention to this flag on componentconfig.go:
https://github.com/kubernetes/kops/blob/master/pkg/apis/kops/componentconfig.go#L284

But when I try to add that to my ClusterSpec, I get:

# Found fields that are not recognized
# ...
#     cloudProvider: aws
#     configBase: s3://<redacted>
# +   enableCustomMetrics: true
#     etcdClusters:
#     - etcdMembers:
# ...

(Running kubernetes 1.6.4 and kops 1.6.2)

Is this supposed to work?

@chrislovecnm
Copy link
Contributor

You might need to add it to the kubelet sections in the cluster manifest.

Do a get cluster -o yaml --full to view the sections. I have a PR open that talk more about editing and using the yaml btw.

kops get cluster -oyaml --full

Should print out what I need.

@Cisneiros
Copy link

Cisneiros commented Jun 30, 2017

@chrislovecnm Thanks, I see the kubelet section! But how would I edit that section? Passing --full to kops edit cluster gives me an error.

Should I just go to S3 and edit something by hand?

@chrislovecnm
Copy link
Contributor

--full is purely a diagnostic option

See #2795 for more information. May be easier moving to pure YAML.

@chrislovecnm
Copy link
Contributor

We should probably add this to the clusterspec document since this is asked twice. I am going to close this as we have #1467 open.

@itskingori
Copy link
Member

@23doors yes there's a way ... and @Cisneiros your config looks wrong (enableCustomMetrics should be under kubelet). I've included a caveats and an example in #1467 (comment).

@chrislovecnm I think the issue people are having the one in the linked comment ☝️... which is an issue with the resolvConf attribute being set to null when undefined.

k8s-github-robot pushed a commit that referenced this issue Nov 28, 2017
Automatic merge from submit-queue.

Map horizontal-pod-autoscaler-use-rest-clients flag

Maps `--horizontal-pod-autoscaler-use-rest-clients` flag which is required for [Horizontal Pod Autoscaling][1]. See Kubernetes code in [kubernetes/kubernetes/blob/v1.7.11/cmd/kube-controller-manager/app/autoscaling.go#L36-L39][2].

Seems this is the missing piece for fulfilment of HPA pre-requisites, which are:

* ✅ Enable the [Aggregation Layer][4] via the following kube-apiserver flags
   * ✅ `--requestheader-client-ca-file=<path to aggregator CA cert>` (see #3679)
   * ✅ `--requestheader-allowed-names=aggregator` (see #3679)
   * ✅ `--requestheader-extra-headers-prefix=X-Remote-Extra-` (see #3679)
   * ✅ `--requestheader-group-headers=X-Remote-Group` (see #3679)
   * ✅ `--requestheader-username-headers=X-Remote-User` (see #3679)
   * ✅ `--proxy-client-cert-file=<path to aggregator proxy cert>` (see #3165)
   * ✅ `--proxy-client-key-file=<path to aggregator proxy key>` (see #3165)
* ❓ [Horizontal Pod Scaling][3] ... set the appropriate flags for `kube-controller-manager`:
  * ❎  `--horizontal-pod-autoscaler-use-rest-clients` should be `true`.
  * ✅ `--kubeconfig <path-to-kubeconfig>` (already set)

**Relevant Documentation:**

* https://v1-7.docs.kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
* https://v1-7.docs.kubernetes.io/docs/tasks/access-kubernetes-api/configure-aggregation-layer/

**Relevant Issues & PRs:**

* #3679
* #3152
* #2691
* #2652
* #3165

[1]: https://v1-7.docs.kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
[2]: https://github.com/kubernetes/kubernetes/blob/v1.7.11/cmd/kube-controller-manager/app/autoscaling.go#L36-L39
[3]: https://v1-7.docs.kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
[4]: https://v1-7.docs.kubernetes.io/docs/tasks/access-kubernetes-api/configure-aggregation-layer/
@antran89
Copy link

antran89 commented May 8, 2018

A LATE TO THE PARTY: (Hope it helps for new comers like me) I think there is a tutorial to do it:
https://github.com/kubernetes/kops/blob/master/docs/horizontal_pod_autoscaling.md#support-for-multiple-metrics

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

No branches or pull requests

5 participants