Secret delivery option 1: Platform-native secrets (Docker Swarm + K8s Secrets) #130
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Parent epic: #129
Overview
Use Docker Swarm's built-in secret management and Kubernetes Secrets to deliver secrets to provisioned containers, leveraging each platform's native encryption and access control.
Docker Swarm Secrets
How They Work
/run/secrets/<name>--autolockrequires unlock key after manager restartdocker-java Library Support
The docker-java library (v3.4.1, our current version) does support Swarm secret operations:
CreateSecretCmdListSecretsCmdRemoveSecretCmdCritical Limitation: Services Only
Docker Swarm secrets are only available to Swarm services, NOT standalone containers.
dockerClient.createContainerCmd()cannot attach secrets — onlydockerClient.createServiceCmd()withServiceSpeccan.This means our current architecture using
createContainerCmd()inDockerRuntimeOrchestratorcannot use Swarm secrets without a major refactor to the Swarm service model (different lifecycle, networking, replica management).Rotation
No built-in versioning. Pattern: create new secret (
db_password_v2), update service to swap old→new, delete old. Requires rolling service updates.Kubernetes Secrets
Encryption at Rest
--encryption-provider-configon kube-apiserveridentity(none),secretbox(XSalsa20-Poly1305),aescbc,aesgcm,kmsv1/v2--secrets-encryptionflag. Default:aescbc. Cannot enable after initial start without re-provisioningDelivery Mechanisms
secretKeyRef)kubectl describe pod,/proc/*/environsecretVolumeSource)External Secrets Operator (ESO)
Sealed Secrets (Bitnami)
Actively maintained (v0.36.5, April 2026). Solves GitOps secret storage, not runtime secret delivery — low relevance for our use case. Recent CVE-2026-22728 (scope widening) fixed in v0.36.0+.
Programmatic Creation (Java)
Fabric8 Kubernetes Client (most popular Java K8s client, good Spring Boot integration):
Natural fit for Cameleer3's deployment flow: create Secret at PRE_FLIGHT → reference in PodSpec as volume mount.
Cross-Platform Analysis
Abstraction Feasibility
createContainerCmd()createServiceCmd()Single-codebase abstraction is difficult. Swarm's service-only requirement is the main obstacle.
What Major Platforms Do
Key insight: Most platforms at our scale (Coolify, CapRover) use encrypted-at-rest DB + env var injection. Only enterprise platforms use platform-native secrets.
Security Assessment
NIST / CIS Guidance
no-secrets-as-env-varsvia Policy ControllerEnv Var Attack Vectors
docker inspect/proc/*/environkubectl describe podDelivery Mechanism Comparison
/proc/*/environ)Recommendation
Verdict: ⭐⭐ (2/5) as standalone strategy
Docker Swarm secrets are incompatible with our
createContainerCmd()architecture. Migrating tocreateServiceCmd()is a major refactor with significant behavioral changes.K8s Secrets are a good fit when on K8s (4/5 alone), but don't help on Docker standalone or Swarm without K8s.
Cannot serve as the sole strategy across all three platforms. Better as a Phase 2 enhancement for K8s deployments, combined with a file-mount approach for Docker standalone.
What To Do
--secrets-encryptionon our cluster if not already doneSources