Enable ACLs on k8s consul with Vault-sourced bootstrap token #280
Reference in New Issue
Block a user
Delete Branch "benvin/consul-acls"
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?
Why
Phase 1 of the consul VM to k8s migration: bring the k8s consul cluster to ACL parity with the authoritative VM cluster before the eventual snapshot-restore. The VM cluster runs ACLs enabled with
default_policy: denyanddown_policy: extend-cache; the k8s cluster currently runs with ACLs disabled. Sourcing the bootstrap/management token from Vault lets the k8s cluster bootstrap with the sameinitial_managementtoken as the VM cluster, so puppet automation and the snapshot-restore line up. No token material is placed in git.Changes
global.acls.manageSystemACLsso the chart manages system ACL tokens/policies for consul components.global.acls.bootstrapTokenat a pre-existing Kubernetes secretconsul-bootstrap-acl-token(keytoken); chart 1.9.7 supports this, and when the secret is populated theserver-acl-initjob skips bootstrapping and adopts that token as the management token (renders-bootstrap-token-secret-name/-bootstrap-token-secret-key, verified in the kustomize output).VaultAuth(mountk8s/au/syd1, roledefault, SAdefault) andVaultStaticSecretin theconsulnamespace that synckv/kubernetes/namespace/consul/default/bootstrap-acl-tokeninto theconsul-bootstrap-acl-tokenk8s secret via VSO (mirrors the encapi pattern).aclblock (enabled,default_policy: deny,down_policy: extend-cache,enable_token_persistence) into the serverextraConfigto match the VM posture.OPERATIONAL NOTE — required BEFORE merge
The user MUST place the VM cluster's
initial_managementtoken in Vault first, or ACL bootstrapping will generate a different token and break the mirror:VSO then syncs it into the
consul-bootstrap-acl-tokensecret before theserver-acl-initjob runs. No terraform-vault change is needed: the wildcarddefaultk8s-auth role (bound_service_account_namespaces: ['*']) plus the templatedkv/kubernetes/defaultpolicy already grant theconsulnamespacedefaultSA read onkv/kubernetes/namespace/consul/default/*.Risk / expected behavior
server-acl-initjob.default_policy: deny, previously-anonymous operations are denied. Thevaultservice in the k8s catalog is self-registered by the Vault/OpenBao servers (namespacevault) via theirservice_registration "consul"stanza (catalog entry hasServiceMeta.external-source: vault, port 8200). After the flip this registration will be denied unless Vault is given a Consul ACL token withservice:writeonvault(and the anonymous token is not granted that). This must be handled as part of the cutover — either grant the anonymous token limited write, or configure a token in Vault's consul service_registration./v1/status/leader) will also be denied post-merge unless a token is supplied — see PR 2 verification note.Ordering
Independent of the API-route PR (
benvin/consul-api-route). Both precede phase 3 (snapshot). Do not merge until the Vault step above is done.