A production-grade Kubernetes multi-tenancy implementation using namespace-based isolation. Each squad gets a dedicated namespace with scoped RBAC, ResourceQuotas, LimitRanges, and NetworkPolicies — giving teams full autonomy within enforced guardrails.
┌─────────────────────────────────────────────────────────────────────┐
│ EKS Cluster │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Platform Namespace │ │
│ │ ArgoCD · Gatekeeper · Falco · Prometheus · Ingress │ │
│ └─────────────────────────────────────────────────────────────┘ │
│ │
│ ┌───────────────┐ ┌───────────────┐ ┌───────────────┐ │
│ │ team-alpha │ │ team-beta │ │ team-gamma │ ... │
│ │ │ │ │ │ │ │
│ │ RBAC scoped │ │ RBAC scoped │ │ RBAC scoped │ │
│ │ Quota: 8CPU │ │ Quota: 8CPU │ │ Quota: 4CPU │ │
│ │ Quota: 16Gi │ │ Quota: 16Gi │ │ Quota: 8Gi │ │
│ │ NetworkPolicy│ │ NetworkPolicy│ │ NetworkPolicy│ │
│ │ LimitRange │ │ LimitRange │ │ LimitRange │ │
│ └───────────────┘ └───────────────┘ └───────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────────────┐ │
│ │ Cluster-Wide Controls │ │
│ │ OPA Gatekeeper · PodSecurityAdmission · ResourceQuotas │ │
│ └─────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
Each squad namespace enforces the following controls independently:
| Control | Implementation | Purpose |
|---|---|---|
| Identity | RBAC RoleBindings | Developers can only access their own namespace |
| Compute | ResourceQuota | Prevents one team from starving others |
| Container defaults | LimitRange | Enforces sane defaults if team omits limits |
| Network | NetworkPolicy | Zero-trust between namespaces by default |
| Pod security | PodSecurityAdmission | Baseline or restricted profile per namespace |
| Image source | Gatekeeper constraint | Teams can only pull from approved registries |
.
├── namespaces/
│ ├── team-alpha/ # Full tenant config for team-alpha
│ ├── team-beta/ # Full tenant config for team-beta
│ └── team-gamma/ # Full tenant config for team-gamma (restricted)
├── rbac/
│ ├── clusterroles/ # Platform-wide roles (read-only cluster viewer)
│ ├── roles/ # Namespace-scoped roles (developer, viewer, ci)
│ └── rolebindings/ # Bindings per team
├── quotas/ # ResourceQuota + LimitRange templates
├── network-policies/ # NetworkPolicy patterns per isolation level
├── admission/ # PodSecurityAdmission labels + Gatekeeper constraints
└── docs/
├── onboarding.md # How to onboard a new team
└── runbook.md # How to handle quota exhaustion and policy violations
# Copy the team-alpha template
cp -r namespaces/team-alpha namespaces/team-newteam
# Update the team name throughout
find namespaces/team-newteam -type f | xargs sed -i 's/team-alpha/team-newteam/g'
# Apply
kubectl apply -f namespaces/team-newteam/
kubectl apply -f rbac/rolebindings/team-newteam-rolebinding.yaml# Namespaces first
kubectl apply -f namespaces/
# RBAC
kubectl apply -f rbac/clusterroles/
kubectl apply -f rbac/roles/
kubectl apply -f rbac/rolebindings/
# Network policies
kubectl apply -f network-policies/
# Admission controls
kubectl apply -f admission/# Confirm a developer cannot access another team's namespace
kubectl auth can-i get pods -n team-beta \
--as=system:serviceaccount:team-alpha:developer
# Expected: no
# Confirm quota is enforced
kubectl describe resourcequota -n team-alpha
# Confirm network policy blocks cross-namespace traffic
kubectl run test --image=busybox -n team-alpha --rm -it -- \
wget -T 3 http://my-service.team-beta.svc.cluster.local
# Expected: timeoutThree roles per namespace, following least-privilege:
| Role | Can Do | Cannot Do |
|---|---|---|
developer |
deploy, scale, view logs, exec into pods | modify RBAC, create secrets, access other namespaces |
viewer |
read-only across all resources in namespace | create, update, delete anything |
ci-deployer |
create/update deployments and services only | exec, port-forward, view secrets |
Three quota tiers based on team size and workload:
| Tier | CPU Request | CPU Limit | Memory Request | Memory Limit | Pods |
|---|---|---|---|---|---|
| Standard | 4 | 8 | 8Gi | 16Gi | 20 |
| Large | 8 | 16 | 16Gi | 32Gi | 40 |
| Restricted | 2 | 4 | 4Gi | 8Gi | 10 |
Default posture: deny all cross-namespace traffic. Teams explicitly allow only what they need.
Allowed by default within a namespace:
- Pod-to-pod communication
- DNS (kube-dns)
- Ingress from the ingress controller namespace
Blocked by default:
- All ingress from other team namespaces
- All egress except DNS and HTTPS (443)
| Repo | Purpose |
|---|---|
| aws-eks-platform | Terraform — VPC, EKS, IAM |
| gitops-eks-platform | GitOps — ArgoCD workloads |
| k8s-security-platform | Security — Gatekeeper + Falco |
| k8s-multi-tenancy (this repo) | Multi-tenancy — RBAC, Quotas, NetworkPolicy |