zero-trust-mesh
by Das Meta
Helm chart for Kubernetes NetworkPolicy + Istio zero-trust service communication
About this chart
zero-trust-mesh
Minimal Helm chart for strict Kubernetes + Istio zero-trust communication.
Security model
- Default deny ingress/egress via
NetworkPolicy - Exact pod-to-pod allow rules only (no broad namespace trust)
- STRICT mTLS via Istio
PeerAuthentication - Default deny via Istio
AuthorizationPolicy - Service-account based allow rules with optional HTTP methods/paths
- External egress only to approved hosts or IP blocks
Two deployment modes
Use the same chart in two layers:
- Namespace baseline (install once per namespace)
- Service rules (install per workload)
1) Namespace baseline
Enable namespace-wide resources:
namespace: default
namespaceResourcesEnabled: true
allowPolicies: []
This creates namespace-scoped defaults:
- default deny network policy
- DNS allow policy
- egress-gateway-only network policy
- STRICT mTLS
- default deny authorization policy
2) Service rules
Enable per-service deny-all first, then add explicit allow entries as traffic is validated:
service: frontend
namespaceResourcesEnabled: false
denyAll:
enabled: true
allowPolicies:
- type: ingress
service: gateway
podLabels:
app: gateway
port: 80
- type: ingress
service: ingress-nginx
namespace: ingress-nginx
podLabels:
app.kubernetes.io/name: ingress-nginx
app.kubernetes.io/component: controller
port: 80
allowUnauthenticated: true
- type: egress
service: backend
podLabels:
app: backend
port: 8080
- type: egress
hosts: ["api.stripe.com"]
- type: egress
ips: ["192.0.2.10"]
ports:
- number: 443
protocol: TCP
Values design
denyAll is a service-scoped deny-all switch:
enabled(optional, defaultfalse)podLabels(optional selector override; defaults toapp.kubernetes.io/name: <service>)
When enabled, it renders:
- a service-scoped NetworkPolicy with both
IngressandEgresspolicy types and no allow rules - a service-scoped Istio AuthorizationPolicy default deny for inbound mesh traffic
- service-scoped DNS and
istiodegress NetworkPolicy exceptions so injected sidecars can keep receiving mesh configuration while application traffic stays denied
allowPolicies is the preferred typed allow list owned by the current service.
For type: ingress entries:
service(required source service name;workloadis accepted as a legacy alias)namespace(optional source namespace, defaults to Helm release namespace)podLabels(optional source pod selector override; defaults toapp.kubernetes.io/name: <service>)sourceIpBlocks(optional source CIDR allow list for non-pod sources such as AWS ALB target-typeip)serviceAccount(optional source service account override; defaults toservice)port/protocol(optional, defaults to80/TCP)methods/paths(optional Istio operation filters)allowUnauthenticated(optional, defaultfalse): omit the Istio source principal match for non-mesh sources such asingress-nginx; keeppodLabelsset so NetworkPolicy still restricts packet sources
For type: egress entries, service destinations use service as the peer
service name. For service destinations it renders service-scoped egress
NetworkPolicy rules only; the destination service must open inbound traffic
with its own ingress allow policy if it has denyAll.enabled: true.
type: egress supports three destination forms:
- Service rule:
service(required;workloadis accepted as a legacy alias)namespace(optional, defaults to Helm release namespace)podLabels(optional target pod selector override for generated egressNetworkPolicy; defaults toapp.kubernetes.io/name: <service>)port(optional, default8080)protocol(optional, defaultTCP)serviceAccount/methods/pathsare only used by the legacy target-side ingress mode
- Host rule:
hosts(list of approved external hosts)ports(optional list; merged with defaults80/HTTPand443/HTTPS)pathscan be provided in values for future/egress-gateway routing use, but are not enforced byServiceEntry-only mode- renders Istio
ServiceEntryresources and, when service deny-all is enabled, a service-scoped public-IP egressNetworkPolicyfor the selected ports
- IP rule:
ips(list of approved external destination IPs or CIDR blocks)ports(optional list; defaults to443/TCP)- single IPv4 addresses are rendered as
/32CIDRs forNetworkPolicyipBlock - renders both an Istio
ServiceEntrywithresolution: NONEand a workload-scoped egressNetworkPolicy
Source service account defaults to service, or can be set with top-level serviceAccount.
Resource naming
Rendered resource names use this scoped pattern:
<release>-<namespace>-<service>-<purpose>-<hash>
The readable prefix includes the Helm release, workload namespace, and target service/workload. The hash is derived from the full resource identity, including rule-specific values such as peer namespace, peer service, ports, hosts, IPs, and service accounts. The prefix is truncated when needed so the final name stays within the Kubernetes 63-character limit.
If your cluster does not have an istio-egressgateway Service name, set:
istio.egressGateway.serviceNameto your real gateway Serviceistio.egressGateway.selectorto labels of that gateway workloadnetworkPolicy.egressGateway.podLabelsto the same labels (so egress NP allows traffic to it)
Most security defaults are now implicit in templates. Advanced overrides can still be set under networkPolicy and istio in values.full.yaml.
Key values
| Key | Description | Default / Example |
|---|---|---|
service | Current service name used for pod selectors and default source service account | Helm release name |
workload | Deprecated alias for service | Helm release name |
serviceAccount | Source service account override | "" |
namespaceResourcesEnabled | Enables namespace-wide default deny, DNS, egress gateway, mTLS, and default-deny AuthorizationPolicy resources | false |
denyAll.enabled | Enables service-scoped deny-all for both inbound and outbound traffic | false |
denyAll.podLabels | Optional pod selector override for service-level deny-all resources | Not set; defaults to app.kubernetes.io/name: <service> |
allowPolicies | Preferred typed inbound/outbound allow rules owned by the current service | [] |
allowPolicies[].type | Policy direction, either ingress or egress | ingress |
allowPolicies[].service | Peer service name for ingress source or egress destination | backend |
allowPolicies[].workload | Deprecated alias for allowPolicies[].service | backend |
allowPolicies[].podLabels | Optional peer pod selector override for generated NetworkPolicy | { app: backend } |
allowPolicies[].sourceIpBlocks | Optional ingress CIDR allow list for non-pod sources such as AWS ALB target-type ip | ["172.31.0.0/16"] |
allowPolicies[].serviceAccount | Optional peer service account override for AuthorizationPolicy principals | allowPolicies[].service |
allowPolicies[].allowUnauthenticated | Allow non-mesh inbound sources; NetworkPolicy should still restrict source pods or CIDRs | false |
allowPolicies[].hosts | Approved external hosts for ServiceEntry-based egress | ["api.stripe.com"] |
allowPolicies[].ips | Approved external destination IPs or CIDR blocks for direct IP egress | ["192.0.2.10"] |
Install
helm upgrade --install ztm-baseline ./zero-trust-mesh -n default -f values.full.yaml
Istio prerequisite
Set mesh outbound mode in IstioOperator/istiod:
meshConfig:
outboundTrafficPolicy:
mode: REGISTRY_ONLY
This chart assumes namespaces have the standard label kubernetes.io/metadata.name.
Deploy zero-trust-mesh with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has zero-trust-mesh on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartzero-trust-mesh is pinned at v0.1.6 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply