docs(self-managed): add credential rotation procedures

What this does

Adds ## Rotating credentials to docs/dev/self-managed-install.md, and an example Role for Secret access in stage 3.

AR, iam-data-access, and GitLab read each Secret once, at startup, so every procedure ends in a restart:

Value Method Downtime
IAM service token, GitLab-to-AR token Accept two, switch the senders, drop the old one. Both tokens in one pass None on Gateway. On Ingress, AR is unreachable while the Ingress is patched again after the AR helm upgrade in steps 1 and 3
PostgreSQL and Redis passwords Change it at the source, patch the Secret, restart. With CloudNativePG, patch its generated Secret New connections fail between the change and the restart. Open ones keep working
Cloud Connector key GitLab's key rotation, with AR and iam-data-access restarted where the AI Gateway would be None
Encryption root key The key-rotation.md procedure, with kubectl in place of Vault None

self-managed-limitations.md, risk 10: rotation is covered now, so the row keeps only the shared namespace, with the stage 3 Role as a mitigation. It now points to #1712, which tracks the shared namespace.

Evidence

Claim Where
iam-data-access accepts service_token and next_service_token, read at boot IAM v1.80.2, pkg/serviceauth/config.go:24
AR accepts auth.gitlab_api.next_service_token, read at boot AR v2.149.0, cmd/artifact-registry/wire_gitlab.go:99
GitLab copies both tokens into the pod at start, and caches them Chart v10.5.0 webservice, sidekiq, and toolbox init containers; Authn::IamDataAccessService.secret, ArtifactRegistry::ServiceCredential#token (strong_memoize)
GitLab chart Deployments carry app: <chart name> Chart v10.5.0, templates/_application.tpl, gitlab.standardLabels
GitLab caches the signing key per process. AR tokens live 5 minutes by default, and up to 12 hours CloudConnector::CachingKeyLoader; TokenIssuer::DEFAULT_TTL_SECONDS; API::Authn::TokenExchange::MAX_EXPIRES_IN_SECONDS (GitLab v19.5.0-ee)
The key rake tasks: create publishes, rotate swaps, trim removes the newest row ee/lib/tasks/cloud_connector/keys.rake, CloudConnector::Keys

Tested on GKE (2026-10-22)

On a pinned copy (AR chart 2.149.0, iam-data-access 1.80.2, CloudNativePG 1.30) installed from this guide:

Procedure Result
Shared tokens, steps 1 to 3 After step 1, old and new tokens are accepted by AR and IAM. After step 3, only the new ones
PostgreSQL and Redis passwords Open connections survive the change. Restarts with the new Secret become ready. CloudNativePG updates the role from its patched Secret
Redis password check (redis-cli PING with the password from ar-redis-conn), under Pod Security restricted PONG and exit 0 with the right password. Exit 1 with a wrong password or a missing Secret
Every need/put block in the section, with no input files No patch and no restart, in bash and zsh
Root key, steps 1 to 4, with real encrypted rows root_key_uri changes as expected, verification passed, verify passed, the first-line check matches, and AR starts with the new key only
need, put, restart, the URI check Work in bash and zsh. put refuses a missing or empty file, and an undefined helper patches nothing
The stage 3 Role Its group can read Secrets. view cannot, edit can

On a GitLab 19.4 install with iam-data-access 1.55.3 and AR 2.82.1 (both have the overlap fields), then reverted:

Procedure Result
Shared tokens, with GitLab as the sender The selector restarted exactly webservice, sidekiq, and toolbox. After step 3, the old GitLab-to-AR token got 401 and the new one passed
Cloud Connector key, create and rotate Before AR restarts, a token signed with the new key gets 401. After the restart, both keys pass

The 12-hour wait and the trim were not run in full. AR rejecting the trimmed key after a restart follows from the one-time JWKS fetch (accepted risk 4) and was not observed.

Verification

  • Vale: 0 errors, no new warnings. markdownlint: 0 issues.

Closes #1553 (closed) Closes gitlab-org/gitlab#634458 (closed)

🤖 Generated with Claude Code

Edited by Suleimi Ahmed

Merge request reports

Loading
Loading