Confidential Containers with Kata
Deploy confidential containers using Kata Containers and TEEs on Kubernetes. Hardware attestation, encrypted container images.
π‘ Quick Answer: Confidential Containers (CoCo) run workloads inside hardware TEEs (AMD SEV-SNP or Intel TDX) using Kata Containers as the runtime. Install the CoCo operator, create a
RuntimeClassforkata-cc, and deploy pods withruntimeClassName: kata-cc. The workload runs in an encrypted VM β even the cluster admin canβt see the memory contents.
The Problem
Standard Kubernetes pods share the host kernel, and cluster admins can inspect any podβs memory. For regulated workloads (healthcare, finance, multi-tenant AI), you need protection even from the infrastructure provider. Confidential Containers combine Kata Containers (VM-level isolation) with CPU-level encryption (SEV-SNP/TDX) β the workload is encrypted in memory, and only the CPU can decrypt it.
flowchart TB
subgraph STANDARD["Standard Pod"]
APP1["Application"] --> KERNEL["Shared Host Kernel"]
ADMIN["Cluster Admin"] -->|"can inspect"| APP1
end
subgraph CONFIDENTIAL["Confidential Container"]
APP2["Application"] --> KATA["Kata VM<br/>(guest kernel)"]
KATA --> TEE["TEE<br/>(SEV-SNP / TDX)"]
ADMIN2["Cluster Admin"] -->|"β CANNOT inspect<br/>memory encrypted"| APP2
endThe Solution
Install CoCo Operator
# Prerequisites: nodes with AMD SEV-SNP or Intel TDX support
# Check hardware support:
# AMD: dmesg | grep -i sev
# Intel: dmesg | grep -i tdx
# Install Confidential Containers operator
kubectl apply -f https://github.com/confidential-containers/operator/releases/latest/download/deploy.yaml
# Create CoCo custom resource
cat << EOF | kubectl apply -f -
apiVersion: confidentialcontainers.org/v1beta1
kind: CcRuntime
metadata:
name: ccruntime-default
spec:
runtimeName: kata
config:
installType: bundle
EOF
# Verify RuntimeClass is created
kubectl get runtimeclass
# NAME HANDLER AGE
# kata-cc-sev-snp kata-cc-sev-snp 30s
# kata-cc-tdx kata-cc-tdx 30sDeploy a Confidential Pod
apiVersion: v1
kind: Pod
metadata:
name: confidential-workload
labels:
app: confidential
spec:
runtimeClassName: kata-cc-sev-snp # or kata-cc-tdx
containers:
- name: app
image: registry.example.com/ml-inference:v1.0
resources:
limits:
memory: 4Gi
cpu: "2"
env:
- name: MODEL_KEY
valueFrom:
secretKeyRef:
name: model-decryption-key
key: key
volumeMounts:
- name: encrypted-model
mountPath: /models
volumes:
- name: encrypted-model
persistentVolumeClaim:
claimName: encrypted-model-pvcEncrypted Container Images
# Encrypt a container image for CoCo
# Only the TEE can decrypt it at runtime
# Generate encryption key
openssl rand -out image-key.bin 32
# Build and encrypt image
skopeo copy \
--encryption-key jwe:image-key.pub \
docker://registry.example.com/app:v1 \
docker://registry.example.com/app:v1-encrypted
# The key is released to the TEE via attestation
# (never exposed to the host or cluster admin)Remote Attestation
# Attestation verifies the TEE is genuine before releasing secrets
apiVersion: v1
kind: ConfigMap
metadata:
name: attestation-config
namespace: confidential-containers-system
data:
config.json: |
{
"attestation_url": "https://attestation.example.com",
"policy": {
"allowed_digests": [
"sha256:abc123..."
],
"min_firmware_version": "1.55",
"require_secure_boot": true,
"allowed_platforms": ["sev-snp", "tdx"]
}
}sequenceDiagram
participant POD as Confidential Pod
participant TEE as TEE (SEV-SNP)
participant KBS as Key Broker Service
participant ATTEST as Attestation Service
POD->>TEE: Start in encrypted VM
TEE->>ATTEST: Send attestation evidence<br/>(firmware hash, measurement)
ATTEST->>ATTEST: Verify TEE is genuine
ATTEST->>KBS: Attestation passed
KBS->>TEE: Release decryption keys
TEE->>POD: Decrypt image + secrets
Note over POD: Running with encrypted<br/>memory β host can't readPeer Pods (Remote Attestation for Cloud)
# Peer Pods: TEE runs in a separate cloud VM
# Useful when the K8s node doesn't have TEE hardware
apiVersion: v1
kind: Pod
metadata:
name: peer-pod-workload
annotations:
io.katacontainers.config.hypervisor.machine_type: "sev-snp"
spec:
runtimeClassName: kata-remote
containers:
- name: app
image: registry.example.com/sensitive-app:v1
resources:
limits:
kata.peerpods.io/vm: "1"Common Issues
| Issue | Cause | Fix |
|---|---|---|
RuntimeClass not found | CoCo operator not installed | Install operator and CcRuntime CR |
Pod stuck in ContainerCreating | TEE not available on node | Check dmesg for SEV/TDX support |
| Attestation fails | Firmware version too old | Update BIOS/firmware on host |
| Encrypted image wonβt start | Wrong key or format | Verify key matches encryption |
| Performance overhead | VM boot + attestation | Expected: ~2-5s startup overhead |
Best Practices
- Use SEV-SNP for AMD, TDX for Intel β check your hardware generation
- Encrypt sensitive container images β model weights, proprietary algorithms
- Remote attestation for secrets β never embed keys in manifests
- Separate CoCo nodes β label and taint nodes with TEE hardware
- Test with non-confidential kata first β verify Kata works before adding TEE
- Monitor attestation failures β they may indicate compromised hardware
Key Takeaways
- Confidential Containers protect workloads from infrastructure admins
- CPU-level encryption (SEV-SNP/TDX) β even root on the host canβt read pod memory
- Kata Containers provides VM isolation; TEE provides memory encryption
- Remote attestation verifies hardware integrity before releasing secrets
- Essential for multi-tenant AI inference, healthcare, and financial workloads
- 2-5 second startup overhead is the tradeoff for hardware-level security

Recommended
Kubernetes Recipes β The Complete Book100+ production-ready patterns with detailed explanations, best practices, and copy-paste YAML. Everything in one place.
Get the Book βLearn by Doing
CopyPasteLearn β Hands-on Cloud & DevOps CoursesMaster Kubernetes, Ansible, Terraform, and MLOps with interactive, copy-paste-run lessons. Start free.
Browse Courses βπ Deepen Your Skills β Hands-on Courses
Courses by CopyPasteLearn.com β Learn IT by Doing
