Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

Chapter 7Name in the course: Container runtime sandboxes and pod-to-pod encryption

Isolate workloads with sandboxes and mTLS

Normal containers share the host kernel. For untrusted code, a sandboxed runtime (gVisor, Kata Containers) adds a second barrier. Between pods, mTLS (mutual TLS) encrypts traffic and proves who is talking.

  • 4 Lessons
  • 3 Commands

$ run as a normal user# run as root (or with sudo)

Skills in this chapter

  • Sandboxed runtimes and pod-to-pod encryption

7.1

Use a sandboxed runtime with RuntimeClass

A RuntimeClass names a runtime handler configured in containerd (for example runsc for gVisor). Pods choose it with runtimeClassName.

runtimeclass.yaml
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata: { name: gvisor }
handler: runsc
---
apiVersion: v1
kind: Pod
metadata: { name: untrusted, namespace: shop }
spec:
  runtimeClassName: gvisor
  containers:
    - name: app
      image: nginx:1.27
kubectl apply -f runtimeclass.yaml
kubectl exec untrusted -n shop -- dmesg | head -2
[    0.000000] Starting gVisor...
kubectl get runtimeclass
SandboxHow it isolates
gVisor (runsc)A user-space kernel catches system calls
Kata ContainersEvery pod in a small virtual machine

Remember

The handler (runsc) must be installed and configured in containerd on the node — the RuntimeClass object alone does nothing.

7.2

Know where sandboxes help

Sandboxes cost some speed and compatibility. Use them where the risk is high.

  • Code from customers or the internet (CI runners, online code playgrounds).
  • Multi-tenant clusters with teams that do not trust each other.
  • Workloads that parse untrusted files (image or document converters).

7.3

Encrypt pod-to-pod traffic with mTLS

With mutual TLS, both sides show a certificate — traffic is encrypted and both identities are proven. A service mesh or the CNI does it without changing the app.

OptionHow
Istio (sidecar or ambient)PeerAuthentication with mode: STRICT
LinkerdmTLS on by default for meshed pods
CiliumTransparent encryption (WireGuard/IPsec) and mutual authentication
istio-strict.yaml
apiVersion: security.istio.io/v1
kind: PeerAuthentication
metadata: { name: default, namespace: shop }
spec:
  mtls:
    mode: STRICT

7.4

Encrypt node-to-node traffic

The CNI can encrypt all pod traffic between nodes, for example Cilium with WireGuard.

cilium install --set encryption.enabled=true --set encryption.type=wireguard
cilium status | grep Encryption

Commands in this lesson

All commands in this chapter