Overview
Deploy Formal Endpoint on Kubernetes to apply Formal to application container traffic. On Kubernetes, Formal Endpoint runs as a native sidecar outside the application container. It is not installed on the host. Configure policies against that traffic as you would on macOS, Windows, or Linux.Cluster requirements
Your cluster must meet these requirements before you run the sidecar.
Verify:
Installation
Install Formal Endpoint as a native sidecar on your application Pod. The recommended path is the Helm chart. It injects the sidecar onto labeled Pods via a MutatingAdmissionPolicy. If you already control the workload spec, or your cluster is older than 1.36, use the Deployment template instead. It adds the sidecar to your Pod template directly, without a MutatingAdmissionPolicy.Add the Formal API Key Secret
The sidecar authenticates as a Formal machine user. Create an API key for that user and store it as a Kubernetes Secret in each namespace that runs labeled Pods. The chart does not create this Secret.1
Create a machine user
Go to Users and click Create User.
Choose Machine. Give the user a name that matches the workload.
2
Create an API key
Go to API Keys and click Create API
Key. Assign the key to that machine user.
3
Create the Secret
Create
formal-kubernetes-egress in every namespace that will run
labeled Pods. The sidecar reads FORMAL_API_KEY from the
formal-api-key key. To use a different Secret, set
formalAPIKeySecret.name and formalAPIKeySecret.key.4
Verify
Deploy with Helm
The chart is published askubernetes-egress in the
Formal Helm Charts repository.
The chart needs Kubernetes 1.36+ and cluster RBAC to manage
MutatingAdmissionPolicy
and
MutatingAdmissionPolicyBinding.
Apply the inject label
The policy binding mutates Pods that have this label set totrue.
spec.template.metadata.labels) of your
Deployment, StatefulSet, DaemonSet, Job, or CronJob:
formal.ai/kubernetes-egress-inject=true on the
workload Pods.
To stop injecting, remove the label from the Pod template and roll the
workload. Existing Pods keep their sidecar until you replace them.
1
Add the Formal Helm repository
2
Install the chart
3
Label Pods to inject
Apply the inject label on the
workload Pod template. New Pods created with that label are injected.
4
Verify
formal-kubernetes-egress init container.helm upgrade --install for every apply.
Image pull credentials
The default image is:654654333078.dkr.ecr.us-east-1.amazonaws.com/formalco-prod-kubernetes-egress:latest
On AKS, pull from GAR with
azure-gar-cred.
Set pullWithCredentials: true and the GAR repository:
ecr-cred when you pull Formal ECR images outside AWS.
Do not install both credential charts in the same namespace.
Add the sidecar to your spec
If you already manage the workload’s manifests or chart, add the sidecar directly to your Pod template instead of installing the Helm chart. This path does not use a MutatingAdmissionPolicy, so it works on Kubernetes 1.29+. This Deployment is a complete template. Replacemy-app, the namespace, and
the app container with your workload, or merge the marked fields into your
existing Deployment, StatefulSet, DaemonSet, Job, or CronJob Pod template.
formal-ca volume, and each
application container trusts it through the TLS trust
environment variables. Create the
Formal API Key Secret in the workload’s
namespace first.
Verify:
formal-kubernetes-egress init container and reaches
Running.
Process attribution
By default, the sidecar intercepts traffic without identifying the application process. To include process metadata in request logs, share the Pod’s process namespace and add two sidecar capabilities. The Helm injector currently adds onlyNET_ADMIN and NET_BIND_SERVICE and does not expose a capability setting.
For process attribution, add the sidecar to your spec and merge these fields:
shareProcessNamespacelets the sidecar see application processes within the Pod. You do not needhostPID.SYS_PTRACEpermits reading another user’s process file descriptor symlinks to identify socket owners.DAC_READ_SEARCHpermits listing and traversing those file descriptor directories. Either capability alone leaves non-root processes unattributed.- Keep
NET_ADMINandNET_BIND_SERVICEfor traffic interception.
runAsNonRoot: true, set it on each application container’s securityContext.
Do not set it at Pod level: the Formal sidecar must run as UID 0.
See Kubernetes process namespace sharing for process visibility and security considerations.
Replace existing Pods after applying your updated workload manifest.
The session.device.connection_process field includes the originating process’s PID, name, and command line.
It does not include a Kubernetes container name or ID.
TLS trust
The sidecar intercepts TLS and presents Formal’s local CA. Injection mounts/formal-ca on every application container. It holds localca-cert.pem, the
Formal CA alone, and ca-bundle.pem, the system CAs plus that CA. Injection
points these environment variables at ca-bundle.pem. Several of them replace
the client’s trust store rather than add to it, so connections the sidecar
does not intercept still verify against the system CAs.
Runtimes that ignore these variables need their own trust configuration.
Import
/formal-ca/localca-cert.pem into a trust store that adds to the system
CAs, or point a setting that replaces the trust store at
/formal-ca/ca-bundle.pem. That includes Java truststores, Go
binaries that embed a CA pool, and some Python clients that pin
certifi (for example httpx).
SSH trust
The sidecar presents its own SSH host certificate. The Helm chart mounts the sidecar’s CA at/etc/ssh/ssh_known_hosts2 in every application container, so
OpenSSH trusts that certificate. The mount replaces any
/etc/ssh/ssh_known_hosts2 in the image, so keep your image’s host keys in
/etc/ssh/ssh_known_hosts.
SSH clients that do not read OpenSSH’s known_hosts files must trust the CA in
/formal-ca/ssh_known_hosts.
Troubleshooting
Sidecar is missing from new Pods
Sidecar is missing from new Pods
Possible causes:
- The Pod spec does not include the sidecar
- Pod is missing
formal.ai/kubernetes-egress-inject: "true" - The label is present with a different value
- The label is on the Deployment or Namespace, not the Pod
- MutatingAdmissionPolicy is not installed
- Confirm the Pod spec includes
formal-kubernetes-egress, or confirm the Pod label - For controllers, confirm
spec.template.metadata.labels - Confirm the admission objects exist if you use the injector
- Create a new Pod. Labeling a running Pod does not inject
Pods fail to start after injection
Pods fail to start after injection
Possible causes:
- Secret
formal-kubernetes-egressis missing - Image pull failed
- Pod Security Standard drops
NET_ADMIN
- Create the Secret in that namespace
- Confirm image pull credentials
- Use Privileged Pod Security, or exempt the namespace
DNS lookups time out in the Pod
DNS lookups time out in the Pod
Cause: The sidecar lacks
NET_BIND_SERVICE. It answers each
intercepted DNS query from port 53, which needs that capability when the
node runtime keeps net.ipv4.ip_unprivileged_port_start at 1024.Fix: Add NET_BIND_SERVICE to the sidecar’s capabilities.add, then
replace the Pod.Verify:Helm install fails on Kubernetes version
Helm install fails on Kubernetes version
Cause: The chart requires Kubernetes 1.36 or later.
Fix: Add the sidecar to your spec, or upgrade the control plane and reinstall the chart.
Fix: Add the sidecar to your spec, or upgrade the control plane and reinstall the chart.
Application TLS handshake fails after injection
Application TLS handshake fails after injection
Possible causes:
- The client ignores the injected CA environment variables
- The client uses a bundled CA store (Java, certifi, a static Go binary)
- Point the client at
/formal-ca/ca-bundle.pem, or add/formal-ca/localca-cert.pemto its trust store - Confirm the container has that file:
kubectl execandls /formal-ca - Restart the Pod so it picks up the current admission mutation
Next Steps
Formal Endpoint
See how the Endpoint authenticates and routes traffic
Write Policies
Control intercepted egress with Rego policies
View Logs
Search Endpoint logs for intercepted requests
Machine users
Manage the identity the sidecar authenticates as