Pod-to-Pod encryption ensures that data transmitted between Kubernetes pods remains secure and protected from eavesdropping or man-in-the-middle attacks.
- Protects sensitive data in transit.
- Prevents network sniffing and unauthorized access.
- Essential for compliance with security standards like GDPR and HIPAA.
- Enables mutual TLS (mTLS) encryption between services.
- Provides automatic certificate management and rotation.
- Enforces authentication and authorization for service communication.
apiVersion: security.istio.io/v1beta1
kind: PeerAuthentication
metadata:
name: default
namespace: default
spec:
mtls:
mode: STRICTistioctl authn tls-check <pod>.<namespace>- Uses IPsec (ESP) or WireGuard to encrypt pod-to-pod traffic at the network level.
- Works at Layer 3 (IP layer), independent of applications.
kubectl patch felixconfiguration default --type='merge' -p '{"spec":{"wireguardEnabled":true}}'kubectl exec -it <pod> -- tcpdump -i eth0 -n port 443- Encrypts HTTP/gRPC traffic using TLS certificates.
- Requires services to support HTTPS or gRPC TLS.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: secure-ingress
spec:
tls:
- hosts:
- example.com
secretName: tls-secret- Define NetworkPolicies to restrict non-encrypted traffic.
- Works with CNI plugins like Cilium, Calico, or Weave.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-tls-only
namespace: default
spec:
podSelector: {}
ingress:
- ports:
- port: 443
protocol: TCP- Check Istio mTLS status:
istioctl proxy-config listeners <pod>.<namespace>
- Inspect encrypted traffic with tcpdump:
kubectl exec -it <pod> -- tcpdump -i eth0 -n
- Ensure WireGuard encryption is enabled:
calicoctl get felixconfig -o yaml | grep wireguardEnabled
✅ Use mTLS with Istio/Linkerd for service-to-service encryption. ✅ Enable IPsec or WireGuard for network-layer encryption. ✅ Enforce TLS at the application level for HTTP/gRPC traffic. ✅ Restrict non-encrypted traffic using NetworkPolicies. ✅ Monitor encrypted traffic with tcpdump and network observability tools.
Reference: Kubernetes Network Security