Gke Multitenancy
Plans and configures multi-tenancy on GKE. Covers namespace isolation, RBAC planning for teams, resource quotas, LimitRanges, network isolation, and cost allocation. Use when designing GKE multi-tenancy, configuring GKE namespaces, setting up resource quotas, or isolating GKE teams. Don't use for single-tenant cluster configuration or general deployment instructions (use gke-basics or gke-app-onboarding instead).
Get the complete skill folder, including its scripts and reference files.
When to use this skill
Use Gke Multitenancy when an AI agent needs a reusable SKILL.md workflow for this job: Plans and configures multi-tenancy on GKE. Covers namespace isolation, RBAC planning for teams, resource quotas, LimitRanges, network isolation, and cost allocation. Use when designing GKE multi-tenancy, configuring GKE namespaces, setting up resource quotas, or isolating GKE teams. Don't use for single-tenant cluster configuration or general deployment instructions (use gke-basics or gke-app-onboarding instead).
When not to use it
Skip Gke Multitenancy when the task is outside the coding category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.
How to install
Where will you use it?
mkdir -p ~/.claude/skills/gke-multitenancy # Save SKILL.md to ~/.claude/skills/gke-multitenancy/SKILL.md
- Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/gke-multitenancy/SKILL.md. For a shared project, commit the folder at .claude/skills/gke-multitenancy/ instead.
- Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
- For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.
Full install guide for Claude, Cursor, and Codex →
Try a starter prompt
After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.
Use the Gke Multitenancy skill for this task: Multiple teams sharing a single GKE cluster. Confirm any required inputs or files before making changes.
What supports this recommendation?
83/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.
- Documentation
- 92/100
- Practical detail
- 92/100
- Source evidence
- 63/100
- Source signals
- 70/100
Model compatibility evidence
- claudeuntested
No model-specific signal or recorded compatibility test was found.
- chatgptuntested
No model-specific signal or recorded compatibility test was found.
- geminiuntested
No model-specific signal or recorded compatibility test was found.
- copilotuntested
No model-specific signal or recorded compatibility test was found.
- llamauntested
No model-specific signal or recorded compatibility test was found.
- perplexityuntested
No model-specific signal or recorded compatibility test was found.
- mistraluntested
No model-specific signal or recorded compatibility test was found.
- grokuntested
No model-specific signal or recorded compatibility test was found.
Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.
What this skill does
# GKE Multi-Tenancy
This reference covers enterprise multi-tenancy patterns on GKE, including namespace isolation, RBAC planning, resource quotas, and network segmentation.
> **MCP Tools:** `apply_k8s_manifest`, `get_k8s_resource`, `check_k8s_auth`, > `describe_k8s_resource`, `delete_k8s_resource`
## Attribution
**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you MUST read [Usage Attribution](references/attribution.md). For commands executed directly in the terminal (never in generated scripts, Terraform, or user code), prefix `gcloud` with `CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gke-multitenancy)"` and append `agent-skills/1.0 (skill:gke-multitenancy)` to `User-Agent` headers.
## When to Use
- Multiple teams sharing a single GKE cluster - Isolating workloads by environment (dev/staging/prod) within one cluster - Implementing least-privilege access control - Cost allocation across teams or projects
## Multi-Tenancy Models
| Model | Isolation | Complexity | Cost | | ----------------------------- | ------------ | ---------- | -------------- | | **Namespace-per-team** | Soft (RBAC + | Low | Lowest (shared | : : Network : : cluster) : : : Policy) : : : | **Namespace-per-environment** | Soft | Low | Low | | **Node pool-per-team** | Medium | Medium | Medium | : : (dedicated : : : : : compute) : : : | **Cluster-per-team** | Hard (full | High | Highest | : : isolation) : : :
> **Golden path recommendation**: Start with namespace-per-team for cost > efficiency. Escalate to stronger isolation only when compliance requires it.
## Namespace Isolation Setup
### 1. Create Namespaces
```bash kubectl create namespace team-a kubectl create namespace team-b kubectl label namespace team-a team=a kubectl label namespace team-b team=b ```
### 2. RBAC Configuration
**Principle**: Grant minimal permissions per namespace. Never bind to `system:authenticated`.
```yaml # Namespace-scoped role for a team apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: name: team-a-developer namespace: team-a rules: - apiGroups: ["", "apps", "batch"] resources: ["pods", "deployments", "services", "configmaps", "jobs"] verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: team-a-developers namespace: team-a subjects: - kind: Group name: "[email protected]" # Google Group apiGroup: rbac.authorization.k8s.io roleRef: kind: Role name: team-a-developer apiGroup: rbac.authorization.k8s.io ```
**RBAC best practices:** Use Google Groups for subject bindings. Prefer namespace-scoped Roles over ClusterRoles. See the `gke-platform-security` skill for full RBAC hardening guidance.
### 3. Resource Quotas
Prevent any single team from consuming all cluster resources:
```yaml apiVersion: v1 kind: ResourceQuota metadata: name: team-a-quota namespace: team-a spec: hard: requests.cpu: "10" requests.memory: "20Gi" limits.cpu: "20" limits.memory: "40Gi" pods: "50" services: "10" persistentvolumeclaims: "10" ```
### 4. LimitRanges
Set default and maximum resource constraints per container:
```yaml apiVersion: v1 kind: LimitRange metadata: name: team-a-limits namespace: team-a spec: limits: - type: Container default: cpu: "500m" memory: "512Mi" defaultRequest: cpu: "100m" memory: "128Mi" max: cpu: "4" memory: "8Gi" ```
> [!IMPORTANT] **Mandatory Defaults**: When defining `min` or `max` limits in a > `LimitRange`, you **must** also define corresponding `default` and > `defaultRequest` values. If you set a `min` or `max` without defaults, any pod > deployed without explicit resource requests/limits will be rejected by the > admission controller.
### 5. Network Isolation
Apply default-deny per namespace (see the `gke-workload-security` skill), then allow intra-team traffic:
```yaml # Allow same-namespace pods to talk + DNS apiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: allow-same-namespace namespace: team-a spec: podSelector: {} ingress: - from: - podSelector: {} egress: - to: - podSelector: {} - to: # Allow DNS - namespaceSelector: {} podSelector: matchLabels: k8s-app: kube-dns ports: - protocol: UDP port: 53 ```
## Cost Allocation
### Labels for Cost Attribution
```bash # Label namespaces for billing kubectl label namespace team-a cost-center=engineering kubectl label namespace team-b cost-center=data-science ```
### GKE Cost Allocation
Enable GKE cost allocation to break down costs by namespace and label:
```bash gcloud container clusters update <CLUSTER_NAME> --region <REGION> \ --enable-cost-allocation ```
View in Cloud Billing > GKE Cost Allocation.
Intended uses
- Multiple teams sharing a single GKE cluster
- Isolating workloads by environment (dev/staging/prod) within one cluster
- Implementing least-privilege access control
- Cost allocation across teams or projects
Implementation notes
- Review the source instructions and adapt inputs before running the workflow.
Try it, then tell us how it went
A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.