Secrets and Configs
SwarmCracker supports SwarmKit secrets and configs. A secret is a blob
of sensitive data (up to 500KB) that is injected into a microVM’s rootfs and
never exposed by inspect. A config is the same mechanism for non-secret
configuration data.
Both are stored on the SwarmKit manager (cluster-wide) and delivered to the node that runs a task, then written into that task’s rootfs at the path the service requests.
Creating a secret or config
Section titled “Creating a secret or config”Create from a file, or - to read from stdin:
swarmcracker secret create db-pass ./password.txtcat tls-cert.pem | swarmcracker secret create tls-cert -
swarmcracker config create app-yaml ./app.yamlList and inspect them. inspect never prints the value — SwarmKit redacts
secret payloads from the control API, and SwarmCracker only shows metadata:
swarmcracker secret lsswarmcracker secret inspect db-pass
swarmcracker config lsswarmcracker config inspect app-yamlAttaching to a service
Section titled “Attaching to a service”Use --secret / --config. The value is a comma-separated spec:
[src=]NAME[,target=PATH][,mode=0400][,uid=N][,gid=N]swarmcracker service create --name api --image myapp \ --secret src=db-pass,target=/run/secrets/db-pass,mode=0400 \ --config src=app-yaml,target=/config/app.yaml,mode=0444src(or a bare value) is the secret/config name or ID.targetdefaults to/run/secrets/<name>for secrets and/config/<name>for configs.modedefaults to0400for secrets and0444for configs.uid/gidare optional (best-effort; not all images preserve them).
Inside the microVM the file exists at target with the requested mode:
# in the guestcat /run/secrets/db-passls -l /run/secrets/db-pass # -r-------- 1 root rootservice update --secret ... / --config ... replaces the service’s grants
(omit them to leave them unchanged).
Rotation
Section titled “Rotation”SwarmKit secrets and configs are immutable — only labels can change. To rotate a value, create a new secret/config and update the service to reference it:
swarmcracker secret create db-pass-v2 ./new-password.txtswarmcracker service update --secret src=db-pass-v2,target=/run/secrets/db-pass apiRemoval
Section titled “Removal”A secret or config cannot be removed while a service still references it:
swarmcracker secret rm db-pass# secret is in use by service(s) api; remove or update them firstRemove or update the referencing services first.
How injection stays safe
Section titled “How injection stays safe”- Secret/config values are never written to logs,
service inspect,task inspect, or metrics. SwarmKit redacts secret payloads, and the CLI only ever prints references (name + target). - Injection targets a private, per-task copy of the image rootfs. The shared image cache is never modified, so a secret cannot leak into another task that uses the same image.
Daemon configuration file
Section titled “Daemon configuration file”The commands above manage SwarmKit secrets/configs. To manage the daemon’s own
configuration file, use swarmcracker config file:
swarmcracker config file lsswarmcracker config file validateswarmcracker config file migrateSee Also: Networking | CLI Reference | Configuration