Repository navigation
feat(k8s): kind cluster with Traefik and cert-manager for the ACME lab test - #5
Merged
Merged
Conversation
…b test Add k8s/ tooling the lab box runs to get a real certificate from a CryptOS Intermediate over ACME: - task k8s:up creates a single-node kind cluster that publishes ports 80 and 443, and installs Traefik (IngressClass traefik), cert-manager and traefik/whoami behind an Ingress. Each manifest is applied server-side only when kubectl diff reports a change, so a re-run changes nothing. - task k8s:issuer creates an ACME ClusterIssuer that trusts the CryptOS root, solves http-01 through Traefik and takes an optional External Account Binding, plus a Certificate for HOST with an ECDSA P-384 key. - task k8s:verify waits for Ready, checks that the served chain verifies to the root, names HOST, has a P-384 key and matches the issued secret, then prints the serial. task k8s:renew forces a renewal through cmctl; task k8s:down deletes the cluster. Every version, digest and checksum lives in k8s/versions.env. DRY_RUN=1 prints the commands. task k8s:check runs shellcheck, the dry runs, kubeconform on the rendered manifests and the chain checks against a throwaway CA; CI also runs k8s:up twice and k8s:down in kind. Closes #4 Signed-off-by: Bugs5382 <12115015+Bugs5382@users.noreply.github.com>
Contributor
Author
|
Closing summary: reproducible lab Kubernetes for CryptOS tests: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The lab box has no Kubernetes, so the real-hardware ACME test (cert-manager getting a certificate from a CryptOS Intermediate) had nowhere to run. This adds
k8s/: tasks that stand up a pinned single-node kind cluster with Traefik, cert-manager andtraefik/whoami, point cert-manager at an Intermediate, verify the served chain, renew and tear down.Closes #4
Changes
task k8s:up: kind cluster (kindest/nodeby digest) publishing ports 80 and 443, Traefik chart rendered withhelm template(IngressClasstraefik, NodePorts mapped by kind), cert-manager manifest, whoami by digest behind a catch-all Ingress, then an HTTP smoke test. Each manifest is applied server-side only whenkubectl diffreports a change, so a re-run changes nothing.task k8s:issuer ACME_URL=... CA_BUNDLE=... HOST=...: ACMEClusterIssuerwith the CryptOS root ascaBundle,http01.ingress.ingressClassName: traefik, and an optional External Account Binding (CryptOS requires one unless the node setsallow_anonymous_accounts). The HMAC goes into a Secret through process substitution and is never logged. Also creates aCertificatefor HOST (ECDSA P-384,rotationPolicy: Always) and a TLS Ingress.task k8s:verify: waits for Ready (and dumps the Certificate, Order and Challenge state if it doesn't get there), reads the served chain withopenssl s_client, and checks that it verifies to the root (-purpose sslserver), names HOST, has a P-384 key and matches the issued secret. Then prints the serial.task k8s:renew:cmctl renew, waits for a new serial, re-verifies.task k8s:down:kind delete cluster(a no-op when there is none).k8s/versions.envholds every version, digest and checksum (kind v0.33.0, node v1.37.0, kubectl v1.37.1, helm v3.22.0, cmctl v2.6.1, cert-manager v1.21.2, Traefik chart 41.6.0, whoami v1.12.0). The tools download into.tools/and are checked by sha256. Nothing is piped into a shell..env.examplegains a k8s block with documentation values only..tools/and.state/are gitignored.ci-k8s.yml:task k8s:checkon every non-draft PR, plus a kind job that runstask k8s:up, runs it again and asserts nothing changed, then runstask k8s:downtwice.Kind rather than k3s: it leaves the lab box's host alone (no system service or host networking changes), tears down with one command, and runs on GitHub-hosted runners, so
up, the re-run anddownare proven in CI rather than only on the box.Testing
task k8s:checkpasses locally, 60 checks under bash 3.2 and 5.3: shellcheck, the pins, every task in dry-run mode, input refusal (http URL, missing or non-PEM bundle, bad host, missing host), the EAB HMAC absent from output and manifests, kubeconform-stricton whoami, the ClusterIssuer and Certificate (schemas found, none skipped) and the Traefik render, andcheck_chainagainst a throwaway P-384 hierarchy (accepts leaf plus intermediate; refuses a missing intermediate, the wrong root, the wrong SAN and an RSA 2048 leaf).actionlintis clean.Not tested yet
k8s:up, its re-run andk8s:downagainst real Docker: the Mac has none. The CI kind job covers them on this PR.k8s:issuer,k8s:verifyandk8s:renewagainst a real CryptOS Intermediate: they need the lab box, with DNS for HOST and the node reaching port 80.Docs
The README is updated. No docs-site change: lab tooling isn't part of the product docs.