Swarm secrets and configuration objects
Worked example
This is an offline lesson. Data are fictional and Docker commands are unexecuted. Any optional execution requires an authorized disposable VM, a verified context, synthetic data, restricted access and no external transmission. Do not collect secrets or private output. Use only the fictional worksheet for this exercise. Before a separately authorized read-only server query, verify the effective endpoint including environment overrides, project or cluster identity, and access scope. Never deploy the fragments, use real credentials or transmit private inspection output.
Synthetic object inventory (names only):secret: app_token_v1 -> app service -> /run/secrets/app_tokenconfig: app_settings_v1 -> app service -> /etc/bm/settings.confproposed rotation: app_token_v2, app_settings_v21. review new object and consumer compatibility2. grant replacement in service update; verify tasks3. revoke old credential when safe; retire unused objectsNo secret value or cluster mutation included.Swarm secrets are transmitted securely to managers and stored encrypted in the Raft log; for Linux tasks they are mounted using in-memory storage when granted. Windows handling differs, so review platform documentation before use. Configs are intended for non-secret content and do not provide the same secret-storage guarantees. Object contents are immutable: create a versioned replacement and update service grants or mount targets. A disconnected running task may retain its existing mounted secret but cannot receive a new version while disconnected. Verify the application actually reads the replacement and that old credentials are revoked in the upstream system, not simply removed from a service specification. Manager access, application access and host protection still matter. Do not expose secret values in inspect output, logs, worksheets or version control. A disconnected task may continue using its existing mounted credential. Do not count only reachable updated tasks as all consumers; define how to handle disconnected tasks before upstream revocation. Retiring a Swarm object does not itself revoke a credential with its issuer.
Common mistake
Do not put credentials in a config object or assume removing a secret grant revokes the underlying credential.
Manual practice
Plan a rotation for the two versioned objects with overlapping credential validity where supported. Include verification of all consumers, disconnected tasks, upstream revocation and an abort decision.
Worksheet: lab-fixtures/docker-swarm-orchestration/05-secrets-configs/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Swarm secrets and configuration objects — Knowledge check
Interpret cluster orchestration evidence and make a safe operational decision.
Where should sensitive credentials be placed in this design?
How do you change immutable object content?
Does removing a service grant necessarily revoke an upstream API token?