Kubernetes TLS Between Pods

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up kubernetes tls between pods by mounting certificates into each workload. You can also run a service mesh sidecar to encrypt network traffic. Teams often store private keys inside native cluster secrets for their apps. When cluster roles are too broad, anyone can read those private keys. Broad permissions also let users run shell commands inside running containers. How kubernetes tls between pods works with native roles To run kubernetes tls between pods, apps need access to certifi

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up kubernetes tls between pods by mounting certificates into each workload. You can also run a service mesh sidecar to encrypt network traffic. Teams often store private keys inside native cluster secrets for their apps. When cluster roles are too broad, anyone can read those private keys. Broad permissions also let users run shell commands inside running containers.

How kubernetes tls between pods works with native roles

To run kubernetes tls between pods, apps need access to certificate files. Platform teams issue certificates from a central authority and store them as secrets. Each pod mounts the secret volume to read its private key at startup. When one pod calls another, both workloads check the peer certificate. This handshake encrypts all data moving across the cluster network.

Native role-based access control governs who can read these secret objects. A Role sets rules inside one namespace for specific cluster resources. A ClusterRole sets rules across the whole cluster for all namespaces. A RoleBinding links a Role to a user or service account. A ClusterRoleBinding grants those permissions across every namespace in the cluster. All rules in this system are additive, and there are no deny rules.

Service accounts need permission to read the secret that holds the certificate. If a team uses a ClusterRoleBinding by mistake, every namespace can read it. You must scope each Role to the exact namespace the app uses. Even then, human engineers often get broad roles to debug pod issues. Those human roles often include access to pod subresources like logs and exec.

What pod encryption solves and what it leaves open

Encrypting traffic between pods stops attackers from reading packets on the network. It proves workload identity before one service sends data to another service. This setup protects data in transit across nodes and cloud networks. It also blocks rogue containers from spoofing trusted internal services.

Still, network encryption does not govern what engineers do inside the cluster. Native roles decide who can log in and open a pod shell. Once an engineer runs an exec session, TLS between pods offers zero protection. The user sits inside the container where traffic is already decrypted. Native roles cannot inspect individual shell commands or block dangerous actions in flight.

Kubernetes RBAC + TLS 1.3 Configuration: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Also, native permissions cannot mask sensitive fields returned in command output. If an engineer queries a local cache or log file, raw data appears. Emails, phone numbers, card numbers, and national IDs show up in plain text. Native subresource rules also struggle to restrict create calls by specific resource names. Teams need a way to control commands and rewrite sensitive output during sessions.

Why service mesh sidecars do not stop human access risks

Many teams adopt a service mesh to automate certificate rotation between pods. The mesh injects a sidecar container into every pod in the namespace. The sidecar handles the TLS handshake and rotates short-lived keys on a schedule. This removes the need for apps to load secret files from disk.

While a mesh secures service-to-service calls, it ignores interactive human sessions. Engineers still use the cluster API to run commands inside app containers. The mesh sidecar only watches network ports between different pods. It never sees commands sent through the cluster API exec subresource. Securing pod traffic is only half of the cluster security picture. You also have to govern human and agent access to the pods themselves.

Add request guardrails and response masking beside Kubernetes

Cluster roles and service accounts govern who reaches the Kubernetes API. Still, a broad role or agent can delete workloads or print sensitive values from ConfigMaps and logs. In practice, hoop.dev runs beside the API server as a sidecar for your Kubernetes API and checks every request and response alongside RBAC.

With hoop.dev Kubernetes controls, guardrails can allow listing Secret names while refusing reads of Secret data before execution. Data masking redacts matched keys in returned JSON responses and log streams in memory. Furthermore, hoop.dev holds SOC 2 Type II and is MIT licensed on GitHub.

Frequently asked questions

Does kubernetes encrypt traffic between pods by default?

No, standard cluster networks send pod-to-pod traffic in plain text by default. You must configure app certificates, network plugins, or a service mesh to encrypt traffic.

How do roles protect TLS secrets in a namespace?

A Role and RoleBinding restrict secret read access to specific service accounts. Because rules are only additive, you must avoid broad bindings that expose keys.

Can pod TLS stop an engineer from reading sensitive app data?

No, pod TLS only encrypts data moving across the network wire between containers. An engineer with exec permissions can still read decrypted data inside the pod.

The query runs. The emails stay hidden.