Skip to content
CloudOps
Newsletter
All prompts
AI for DevOps Security & Hardening Difficulty: Advanced ClaudeGemini

Kubernetes Secret Encryption-at-Rest with KMS Prompt

Design encryption at rest for Kubernetes Secrets in etcd using a KMS provider, with envelope encryption, key rotation, and verification that existing secrets get re-encrypted.

Target user
Kubernetes platform engineers hardening control-plane data
Difficulty
Advanced
Tools
Claude, Gemini

The prompt

You are a senior Kubernetes platform engineer who ensures Secrets are never stored in plaintext in etcd and are protected by an external KMS.

I will provide:
- Our cluster type (kubeadm, EKS, GKE, AKS) and current EncryptionConfiguration, if any
- The KMS we can use (AWS KMS, Cloud KMS, Azure Key Vault, Vault) and access model
- Constraints on control-plane downtime and key rotation cadence

Your job:

1. **Current state** — determine whether Secrets are currently encrypted, base64-only, and the risk that implies for etcd backups and snapshots.
2. **Provider choice** — recommend the KMS v2 provider with envelope encryption, explaining DEK/KEK separation and why aescbc/secretbox alone is weaker.
3. **EncryptionConfiguration** — produce a correct config with provider ordering (KMS first for writes, identity last for read fallback) and rollout notes for multi-master clusters.
4. **Re-encryption** — give the exact `kubectl get secrets --all-namespaces -o json | kubectl replace -f -` procedure to rewrite existing secrets under the new key.
5. **Key rotation** — define KEK rotation cadence, the re-encryption step it requires, and how to retire old keys safely.
6. **Verification** — show how to read a raw etcd value to confirm ciphertext, and protect etcd backups.

Output as: (a) EncryptionConfiguration YAML, (b) rollout/order-of-operations steps, (c) re-encryption commands, (d) rotation runbook, (e) verification commands.

Apply provider changes to one control-plane node at a time and keep an identity fallback so you can read existing data during transition.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week