MATIH Platform is in active MVP development. Documentation reflects current implementation status.
2. Architecture
Network Isolation

Network Isolation

Kubernetes NetworkPolicies enforce network-level isolation between tenant namespaces. Pods in one tenant namespace cannot communicate with pods in another tenant namespace. This provides defense-in-depth beyond application-level tenant context checks.


Default Deny Policy

Each tenant namespace starts with a default-deny policy:

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: default-deny-all
  namespace: matih-data-plane-acme-corp
spec:
  podSelector: {}
  policyTypes:
    - Ingress
    - Egress

This blocks all traffic by default. Subsequent policies whitelist specific allowed traffic.


Allowed Ingress Traffic

SourcePurpose
Same namespace (pod-to-pod)Inter-service communication within tenant
Control Plane namespaceManagement operations, health checks
Tenant's NGINX ingress controllerExternal traffic for tenant's domain
ingress:
  - from:
      - podSelector: {}
  - from:
      - namespaceSelector:
          matchLabels:
            matih.ai/role: control-plane
  - from:
      - namespaceSelector:
          matchLabels:
            matih.ai/role: ingress
        podSelector:
          matchLabels:
            matih.ai/tenant: acme-corp

Allowed Egress Traffic

DestinationPurpose
Same namespaceInter-service communication
Shared infrastructure namespacePostgreSQL, Redis, Kafka, Elasticsearch
DNSKubernetes DNS resolution
egress:
  - to:
      - podSelector: {}
  - to:
      - namespaceSelector:
          matchLabels:
            matih.ai/role: shared-infra
  - ports:
      - port: 53
        protocol: UDP

Blocked Traffic

Traffic PatternStatus
Tenant A pods to Tenant B podsBlocked
Tenant pods to Control Plane pods (except allowed)Blocked
External egress (internet)Blocked (except for declared exceptions)
Direct access to infrastructure from outside clusterBlocked

TLS Everywhere

All in-cluster communication uses TLS:

Communication PathTLS Implementation
Browser to ingresscert-manager TLS certificates
Ingress to serviceTLS termination at ingress
Service to servicemTLS (optional, via service mesh)
Service to databaseTLS-encrypted PostgreSQL connections
Service to RedisTLS-encrypted Redis connections

Monitoring Network Policies

SignalDetection Method
Blocked connection attemptsKubernetes audit logs
NetworkPolicy violationsCNI plugin flow logs (Calico/Cilium)
Unexpected egressEgress policy violation alerts

Related Pages