Setup and test automatically syncing TLS certs into OpenBao #125
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
oeng/argocd-apps#125
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Problem statement
We need to be able to access letsencrypt certs from outside of the
traefikKubernetes Namespace (e.g. access from theenv-mail-stacknamespace - see https://git.open.engineering/oeng/-/projects/8). This will be less of an issue when Traefik 3.8.x rolls out, because it will support ListenerSets (see more context in #1), but as we can only use Gateways at the time of writing, we are limited to auto-generated certs using the Certmanager Gateway shim, which can only generate certs in the same k8s Namespace as the annotated Gateway resource.Certmanager has three suggestions:
Keep in mind that regardless of when Traefik rolls out ListenerSet support, we will still have the issue of needing to backup certs into OpenBao, so exploring Vault/Openbao solutions is important regardless.
Solution hypothesis
We use cert-manager-sync with their hashicorp-vault support, because this has added benefits for backups, whereas the other solutions provide a fix, but don't assist in disaster recovery.
Benefits
Downsides
Actual work to be done
cert-manager.io/secret-templateannotation.This feels clunky, trying to move forward with the
cert-manager.io/secret-templateannotation. See discussion I started here:https://github.com/cert-manager/cert-manager/discussions/9468
So, while we wait for a response on the above discussion in #125 (comment), I came up with another kinda hacky, but maybe longterm viable, way to move forward:
What if we used Kyverno Mutating webhooks?
We already deploy Kyverno as a smol-app by default for smol-k8s-lab and in all our clusters... so what if we also started automatically mutating Kubernetes Secrets with the
controller.cert-manager.io/fao=trueannotation to also have the required cert-manager-sync annotations, such as:I only kind of know what I'm talking about here, but maybe something like:
@jessebot wrote in #125 (comment):
Someone got back to me, so I'm giving their solution a try in #126
@jessebot wrote in #125 (comment):
It worked (as in after adding the annotations in the correct way, certmanager now adds the correct secret template)! I'm now testing with one cert before regenerating others, but some notes:
secret-templateannotation.Next step is to verify why we can't auth to Vault (openbao) and we're getting:
Going to check OpenBao to make sure the core/traefik namespace exists and then verify that the service account we added can create stuff in its namespace.
So, update on this:
cert-manager-syncworks, kind of, but it can't create a secret with the correct name right now, because a Gateway is too broad. It doesn't automatically create a new named secret, you have to specify one. So this isn't going to really work until we have ListenerSets, and even then, it's gonna be a little clunky.So, we have three more paths forward:
If we go with the ESO PushSecrets route, that kind of reduces the amount of tools in the stack that we have to keep track of, but it does add some complexity, at least in the short term, to either our:
For the smol-generic-external-secrets helm chart, we could have a configurable optional push secret per hostname passed in, so we could have an extra helm parameter that's something like
pushTLSCertHostnames=[]. This could work, but is more of a longer term solution for when we go to ListenerSets and every cert is already properly namespaced, at which point thecert-manager-syncsolution is also back on the table.For the traefik smol-app, we could just use the existing
hostnamesparameter, and then use that for creating PushSecrets for each hostname passed in that would otherwise be added to the gateway (since we assume all hostnames for the gateway also include a generated TLS cert). This seems like the most viable.Either way, all the work I did to add appropriate RBAC for certmanager to OpenBao is kind of moot in its current state, unless we go with the Kyverno idea, OR we further explore the reflector/replicator options 🤔
Good news
Ok, so the ESO
PushSecretsin thetraefiknamespace are working! (At least they show as synced into openBao in the PushSecret status 😅See previous work here:
35bf4ac5fb8dc6824da5So the next goal is this: Pull the mail-stack TLS secret back into a referencable secret in our mail-stack namespace.
Work to be done
core/traefikopenbao namespaceWe'll also need to move logic PushSecret generation into the smol-generic-external-secrets helm chart when Kubernetes Gateway API
ListenerSetsresources are supported by Traefik (which is dependent on traefik releasing3.8.x). That work can go into a separate backlogged ticket though. At that time we can revisit how we actually do the automated cert restore viasmol-k8s-lab.Setup and Test cert-manager-sync to automatically sync TLS certs into OpenBaoto Setup and test automatically syncing TLS certs into OpenBaoAutomated cert restoration will be handled as part of oeng/smol-k8s-lab#119 and will be its own independent task exclusively smol-k8s-lab, so after this ticket is resolved, we'll officially close out the "Backup Certs" project as it's main purpose will be satisfied.
jessebot referenced this issue2026-10-15 12:04:34 +00:00
After oeng/smol-k8s-lab#118 is mearged, we can test #128 and then if all goes well, we can finally close this ticket!