ProficientNowTechRFCs

7. Network Policies

RFC-TENANT-SECURITY-0001                                         Section 7
Category: Standards Track                                  Network Policies

7. Network Policies

← WAF Architecture | Index | Next: Rate Limiting →


7.1 Network Policy Overview

7.1.1 Purpose

Kubernetes Network Policies control traffic flow between pods at the network layer. This architecture uses network policies to enforce tenant isolation, control egress, and establish security boundaries.

7.1.2 Policy Types

TypeDirectionPurpose
Ingress PolicyIncoming to podControl who can access pods
Egress PolicyOutgoing from podControl what pods can access

7.2 Policy Hierarchy

7.2.1 Policy Layers

7.2.2 Policy Precedence

LayerAuthorityOverrideInvariant
GuardrailsPlatform TeamCannot be overriddenINV-8
NamespaceTenantWithin guardrailsINV-5
ApplicationTenantWithin namespace policies

7.2.3 Guardrail Policies

Platform guardrail policies that tenants MUST NOT override:

GuardrailPurposeEffect
System namespace isolationProtect kube-system, monitoringDeny tenant access
Platform namespace isolationProtect Vault, KeycloakControlled access only
Egress to metadata servicePrevent credential theftBlock 169.254.169.254
Cross-tenant isolation defaultPrevent lateral movementDeny by default

7.3 Default Policies

7.3.1 Default Deny Ingress

Every tenant namespace MUST have a default-deny ingress policy (INV-5):

AspectBehavior
DefaultAll ingress traffic denied
Explicit allowTraffic only allowed via specific policies
No implicit trustPods cannot receive traffic without policy

7.3.2 Default Deny Egress

Tenant namespace egress MUST be controlled (INV-7):

DestinationDefaultOverride
Same namespaceAllowedPolicy can restrict
Other namespacesDeniedExplicit allow required
Cluster DNSAllowedRequired for service discovery
InternetDeniedExplicit allow required
Metadata serviceDeniedCannot be overridden

7.3.3 Allowed by Default

TrafficReason
DNS (kube-dns/CoreDNS)Required for operation
Same namespace (with policy)Typical application pattern
From ingress namespaceBunkerWeb needs backend access

7.4 Ingress Policies

7.4.1 Ingress from BunkerWeb

Applications MUST allow traffic from the ingress namespace:

FromToPortPurpose
ingress-system/BunkerWebApplication podsApplication portExternal traffic

7.4.2 Ingress from Monitoring

Monitoring systems require access to application metrics:

FromToPortPurpose
monitoring/PrometheusApplication podsMetrics portScraping
monitoring/PrometheusApplication podsHealth portHealth checks

7.4.3 Cross-Namespace Ingress

Cross-namespace traffic requires explicit policies on both sides (INV-6):

RequirementPolicy LocationPurpose
Egress policySource namespaceAllow outbound
Ingress policyDestination namespaceAllow inbound

7.5 Egress Policies

7.5.1 Egress Control Model

7.5.2 Internet Egress

Internet access from tenant namespaces requires explicit policy:

RequirementDescription
Explicit policyEgress to 0.0.0.0/0 must be explicitly allowed
JustificationBusiness reason documented
Scope limitationNarrowest CIDR practical
Port restrictionSpecific ports only (not all)

7.5.3 Platform Service Egress

Tenants requiring platform services:

ServiceNamespaceAccess Method
KeycloakkeycloakExplicit egress policy
VaultvaultVia ESO (no direct access)
MonitoringmonitoringMetrics push if required

7.6 Policy Patterns

7.6.1 Standard Application Pattern

A typical application deployment policy structure:

PolicyPurpose
Default deny ingressBaseline (INV-5)
Default deny egressBaseline (INV-7)
Allow from ingressExternal traffic via BunkerWeb
Allow from monitoringPrometheus scraping
Allow DNS egressService discovery
Allow same-namespaceInternal communication

7.6.2 Database Access Pattern

Applications requiring database access:

PolicyPurpose
Standard policiesAs above
Egress to database namespaceCross-namespace access
Ingress on databaseAccept from application namespace

7.6.3 External API Pattern

Applications calling external APIs:

PolicyPurpose
Standard policiesAs above
Egress to specific IPs/CIDRsExternal API access
Port restrictionHTTPS (443) only

7.7 Policy Lifecycle

7.7.1 Policy Management Flow

7.7.2 GitOps Requirements

Per INV-12, all network policies MUST be:

RequirementDescription
Version controlledStored in Git repository
ReviewedPeer review before merge
AuditableChange history preserved
DeclarativeApplied via GitOps (ArgoCD)
TestableValidated in non-production first

7.7.3 Change Categories

CategoryReview RequiredSecurity Approval
Same-namespace policyPeer reviewNo
Cross-namespace policyPeer reviewYes
Egress to internetPeer reviewYes
Guardrail exceptionN/ANot permitted

7.8 Observability

7.8.1 Flow Logging

Per INV-10, network flows MUST be observable:

DataPurpose
Source pod/namespaceTraffic origin
Destination pod/namespaceTraffic target
Port/protocolService identification
ActionAllow/deny
Policy matchedWhich policy applied

7.8.2 Denied Traffic Alerts

AlertTriggerSeverity
Cross-namespace denialUnexpected policy blockWarning
High denial rateMisconfiguration indicatorWarning
Egress denial spikePossible data exfiltration attemptCritical
Metadata service accessCredential theft attemptCritical

Document Navigation


End of Section 7