-
Notifications
You must be signed in to change notification settings - Fork 158
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
Change the way the certificate for webhook is generated #1345
Comments
Will it be acceptable to fall back to using the Kubernetes apiserver trust root? That seems to be the behaviour if the |
But you still have to put a certificate in the pod, that acts as the ValidatingWebhook, right? |
I wonder if the webhook can issue a CSR to the apiserver and get a signed certificate from it. |
An approach that seems to use that way is described here: TLS Certificates for Kubernetes Admission Webhooks made easy with Certificator and Helm Hook? |
Looks like it uses the same K8s CSR API. Just trying to see if we can avoid introducing external components. |
Thanks for putting #1369 together. It helps to see what the code looks like 👍. At this point, we want to keep Kanister unopinionated in regards to cert management solutions. Depending on the user's requirements, there will always be legit reasons to pick one solution over the other. Our current thinking is to keep the current Helm-generated cert approach as the default mechanism, and offer users who have more advanced, production-readiness requirements with a "bring your own cert" approach, by configuring the Helm chart. Looks like you have already done some work with cert-manager and Kanister. How do you feel about putting together a reference architecture to show how to deploy Kanister into a cluster that already has cert-manager deployed? The Kanister Helm chart will likely need to be updated to make the VWC Then we can publish the reference architecture as documentation and blog post. WDYT? |
Thanks for your feedback! Personally, I do not see why Kanister should not "stand on the shoulder of giants". As "ingress-nginx" and "kube-prometheus-stack" (to only name two) both use the approach with "kube-prometheus-stack" even has the possibility to choose between the approach with Maybe one could choose that path in two steps. First step being using |
Sounds like we agree that cert-manager is a more complete solution. Even As for what the default mode should be, at this point, I think the maintenance overhead and footprint of bringing in Drawing from my experience with service mesh and distributing tracing, most serious clusters would come with its own cert management solutions already. Hence, having a strong "bring your own" story is more important than what the defaults are. I'd argue that the concern with |
I agree that we should recommend the solution with cert-manager. But I still vote for a default with I still refuse to see the helm generated certificate as a valid solution. What happens if someone installs Kanister and does not touch it for 365 days? Suddenly the webhook will just stop working "out of the blue". That's not a good default, imho. |
Won't |
It runs the job on install which creates the certificate and patches the webhook. |
Could we support an alternate way of selecting the cert? By referencing a secret by name for example? |
I'm not sure if the discussion goes into the right direction. We should keep this as simple as possible for the user, preferably with a out of the box solution that "just works" (and does not produce confusing output on every update/install). For the advanced user we should allow the usage of As I'm on maternity leave, I can't invest more time at the moment. But I think the work that has already been made should be sufficient to implement a sophisticated solution. |
Essentially, what @shuguet describes is how cert-manager and many other cert management solutions work i.e. they generate a K8s secret (of type @muffl0n No rush on this. All the best on your maternity leave. |
We are missing one important point here: The ca also needs to be injected into the Webhook. In my example, this is done with this annotation
So it's not only "pick up the secret that somebody created with some tool", it's also "inject the ca into our webhook". Or at least allow the user to specify which annotation to add. But this is only how cert-manager does ist. There is no other similar tool I know of and therefore I have no deeper knowledge what we should consider to allow the user to do. So, as I fear that we are over-engineering this case, I'm coming back to my statement:
|
If user wants to bring their own cert, then the Helm chart won't generate the |
That sound's reasonable, didn't think of it that way. Still having the feeling that it's overkill, though. :) |
This issue is marked as stale due to inactivity. Add a new comment to reactivate it. |
This issue is closed due to inactivity. Feel free to reopen it, if it's still relevant. |
Still relevant. |
Just to add to the convo above: Generating the cert directly in helm exacerbates the issue when working in a GitOps manner with for example ArgoCD (see the image below). Since ArgoCD constantly runs helm under the hood to generate the desired manifest and compares it to the cluster, the diff in the secret will be there indefinitely. While working on my Kanister deployment this leads to headaches dealing with intermittent TLS errors. Going one step further my team has started looking into the Both of these issues would be solved if the cert was generated server-side as opposed to client-side (in helm). |
Currently, the certificate for the ValidatingWebhook is generated on installation.
This has the drawback, that a
helm diff
reports a change on every run. It reports changes (to the certificate) that makes it hard to distinguish what is due to configuration changes made by oneself.I took a look into several solutions and found the way "ingress-nginx" does it the smartest one.
This is a rough breakdown on how they do it:
helm install
theValidatingWebhook
is installed, without cert-dataJob
is installed, that runs immediately, creates a certificate+secret and patches theValidatingWebhook
to use that secretThey use the image jet/kube-webhook-certgen, see eclipse-che/che#17855 (comment) for some more details.
I would love to contribute on this, once it get's accepted as "we should do this". I'm relatively new to webhooks, so this could cost me a bit more of my time. But I'm eager to learn. :)
See https://kanisterio.slack.com/archives/C85C8V22J/p1647870529989079?thread_ts=1647866137.638459&cid=C85C8V22J for reference.
The text was updated successfully, but these errors were encountered: