-
Notifications
You must be signed in to change notification settings - Fork 716
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
Provide proper certificates for kube-scheduler and kube-controller-manager #2244
Comments
@FrediWeber thank you for logging the ticket. we had a long discussion with a user on why we are not singing these for kubeadm and you can read more about this here: IIUC, one undesired side effect, is that if we start doing that our HTTPS probes will fail, as Pod Probe API does not support signed certificates for HTTPS (only self-signed): we could workaround that using a "command" probe that is cert/key aware, but this is difficult as the component images are "distroless" (no shell, no tools). so maybe one day we can support that if core k8s supports it properly. |
@neolit123 Thank you very much for your fast response and the clarifications. If i understand it correctly, the issue kubernetes/kubernetes#80063 is more about mapping the hole PKI dir into the container, external PKIs and shorter renew intervals. I read a little bit about health checks with HTTPS in kubernetes/kubernetes#18226 and https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/.
I don't see any security implications in just mapping the signed certificates and corresponding keys for kube-scheduler and kube-controller-manager. The only negative downside would be, that the certificate rotation would have to be managed. On the other hand this is already the case for other certificates AFAIK. |
i'm not so sure about this and i haven't tried it. my understanding is that if the server no longer has self-signed certificates this means that it would reject any client connections on HTTPS that do not pass authentication.
that is true. however, the discussion there was also about the fact that today users can customize their kube-scheduler and KCM deployments via kubeadm to enable the usage of the custom signed serving certificates for these components if they want their metrics and health checks to be accessible over "true" TLS (i.e. pass the flags and mount the certificates using extraArgs, extraVolumes under ClusterConfiguration). with the requirement of kubeadm managing these extra certificates for renewal, i'm leaning towards -1 initially, but i would like to get feedback from others too. |
Long term, I would love to see the ability to leverage the certificates API to do automated request and renewal of serving certificates for kube-scheduler and kube-controller-manager similar to the work that is being done to enable this support for the kubelet (https://github.com/kubernetes/enhancements/blob/master/keps/sig-auth/20190607-certificates-api.md) |
that was my understanding. then again, we do serve the kube-apiserver on HTTPS and it's probe does not have/pass certficates, so perhaps it would just work.
but again the problem is that this is yet another set of certficates that kubeadm has to manage during renewal, and must consider during our "copy certficates" functionality for HA support. it is not a strict requirement and kubeadm already supports it for users that want to do that using extraArgs. we have a similar case for the kubelet serving certificate which is "self-signed". i'd say, at minimum it would be worthy of a enhancement proposal (KEP): |
i tried to follow the latest iterations of the CSR API closely, but i have not seen discussions around CSRs for the serving certificates of these components via the KCM CA. my guess would be that there might be some sort of a blocker for doing that, given a lot of planning went in the v1 of the API. |
Would it be okay for you if I'd start the process? |
for a feature that is already possible via the kubeadm config/API, the benefits need to justify the maintenance complexity. to me it always seems better to first collect some support (+1s) on the idea before proceeding with the KEP... |
What if the kube-scheduler and kube-controller-manager would manage their front facing server certificate with the
Kubeadm wouldn't have to do anything and there would still be the possibility to provide own certificates if needed. |
this could work, but i guess we will have to own the source code and container image for this new controller. BTW, does the kube-scheduler even support /metrics? for 1.18.0 it just reports:
KCM on the other hand reports what i've expected to see:
|
I just double checked it. |
would you care logging a ticket for that in kubernetes/kubernetes and tag with |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/remove-lifecycle stale |
I was trying to set up metrics scraping with Prometheus and am pretty confused about the current state of things. Is there a recommended way to monitor kube-scheduler (S) and kube-controller-manager (CM) metrics? prometheus-operator/kube-prometheus#718 Prometheus is running on the node, different from a master node, and is expected to scrape S/CM metrics from multiple master nodes. Two issues:
Authentication already happens via service bearer token. I can create another issue, but first, prefer to get some feedback as the current issue is related. |
you can sign certficates for a user that is authorized to access /metrics endpoints.
https://kubernetes.io/docs/reference/access-authn-authz/rbac/ creating certificates: you can then feed such to a TLS client that tries to access the endpoint. alternatively for the legacy behavior of insecure metrics you can grant the user EDIT:
sorry missed that part. in that case there is likely lack of authz. |
I think you didn't understand me. To access the metrics endpoint 3 things must happen:
You are talking about (3), but this is the only part that works. Parts (1) and (2) are broken.
And then propagate to configs via
That works not great in my case. I have an interface facing internet (e.g. 80.1.1.1, 80.1.1.2 ...) on the nodes. Binding to 0.0.0.0 also binds to 80.0.0.x, and metrics become available over internet. I can stop using kubeadm and manually fix the manifests to bind to 10.1.1.x (different value on each node), but at this most likely is going to break components talking to S/CM because AFAIU it is not possible to bind to both 127.0.0.1 and 10.1.1.x, and because of (2).
The service account token already has the
|
My current workaround is to apply the firewall rules on every node BEFORE applying the above steps. Replace the 10.1.1.1 with the node IP:
|
The issue is NOT specific to Prometheus. This is specific to
What is the point in providing metrics endpoint if it cannot be accessed? I guess, kubeadm doesn't do it on purpose, right? |
yes, because it feels like an extension and not something that all users would need. the discussion above had the following:
so technically you should be able to pass extra flags to the components and set them up. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
/remove-lifecycle stale. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
/remove-lifecycle rotten |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
FEATURE REQUEST
Versions
kubeadm version (use
kubeadm version
): 1.18.6Environment:
kubectl version
): 1.18.6uname -a
): 4.19.0-9What happened?
Kubeadm disables the "insecure" ports of kube-scheduler and kube-controller-manager by setting the
--port=0
flag. Therefore metrics have to be scaped over TLS. This is fine but Kubeadm doesn't seem to manage the certificates of kube-scheduler and kube-controller manager. These components - if no certificate is provided - will create a self signed certificate to serve requests. One could just disable certificate verification but that would somehow defer the use of TLS.What you expected to happen?
Kubeadm should create and manage certificates for the "secure" port of kube-scheduler and kube-controller-manager. These certificates should be signed by the CA, that is created by Kubeadm.
How to reproduce it (as minimally and precisely as possible)?
The text was updated successfully, but these errors were encountered: