Watch
0
0
Fork
You've already forked hyperhive
0

k8s: pods log in to the secret store with their ServiceAccount token

The store gets a listener for the pods that asks for no client certificate,
open on the pod network's interfaces only, and a jwt auth mount with one
role per in-cluster service. The rendered pods run under a ServiceAccount
with a projected token in place of their client certificate.
This commit is contained in:
atlas 2026-11-21 14:03:28 +01:00 • committed by mara
commit d1554def7a
2 changed files with 720 additions and 69 deletions

View file

@ -0,0 +1,18 @@
# What the secret store's pod login and the pods' manifests agree on, in one
# place: the auth mount, the audience, and where the projected token is
# mounted. ../swarm-bao.nix writes the mount and its roles from it and
# ../k8s/render.nix renders the pods from it. `DEFAULT_JWT_FILE` in
# swarm-secret-client/src/client.rs is `tokenFile`.
#
# Pure attrset — NOT a NixOS module.
{
# Named in ../bao-bootstrap-policy.hcl, which is a static file.
mount = "jwt-k8s";
# The `aud` the pods ask the API server for and the roles require, so a token
# minted for the Kubernetes API is no use here.
audience = "bao";
tokenDir = "/var/run/secrets/hyperhive/bao";
tokenFile = "/var/run/secrets/hyperhive/bao/token";
}

View file

@ -465,6 +465,11 @@ let
clientCaPath = "${tlsDir}/client-ca.pem";
refreshConsumer = import ./refresh-consumer.nix { };
# The name both ends must agree on: the cert-auth role attaches this policy
# by spelling it the same way, and is itself named after it.
controllerPolicyName = "swarm-controller";
in
{
inherit
@ -497,6 +502,7 @@ in
controllerClientLeaf
controllerForgeTokenLeaf
controllerGrafanaTokenLeaf
controllerPolicyName
controllerWebhookSecretLeaf
createStanza
credentialMountPath