Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)22k · #10290

gke-multitenancy

Skill này làm gì

Skill này giúp agent AI lên kế hoạch cách nhiều nhóm hoặc môi trường dùng chung một cụm GKE một cách an toàn. Skill bao gồm phân tách, phân quyền, hạn mức và theo dõi chi phí.

Khi nào nên dùng

  • ✓Khi nhiều nhóm cần dùng chung một cụm GKE duy nhất.
  • ✓Khi bạn muốn tách môi trường dev, staging và production trong cùng một cụm.
  • ✓Khi bạn cần thiết lập quyền tối thiểu hoặc hạn mức tài nguyên cho từng nhóm.

Liên kết skill

https://github.com/google/skills/blob/main/skills/cloud/gke-multitenancy/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/google/skills/blob/main/skills/cloud/gke-multitenancy/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Ba nhóm của chúng tôi dùng chung một cụm GKE. Làm sao để khối lượng công việc và quyền của họ được tách biệt?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent so sánh các mô hình đa người thuê, như mỗi nhóm một namespace, rồi lên kế hoạch namespace, quyền truy cập theo vai trò, hạn mức, limit range, cách cô lập mạng và theo dõi chi phí.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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. 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

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.

# 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: "team-a@example.com"  # 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:

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:

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:

# Allow same-namespace pods to talk + DNS
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metad
Câu hỏi thường gặp

Nó có cần cho cụm chỉ phục vụ một nhóm không?

Không. Skill nói không dùng cho thiết lập cụm đơn người thuê.

Mỗi nhóm một namespace mang lại gì?

Nó cho sự cô lập mềm bằng quyền theo vai trò và network policy, với chi phí thấp nhất vì cụm được dùng chung.

Nó có thể áp dụng kế hoạch vào cụm không?

Nó có thể dùng công cụ Kubernetes để áp dụng và kiểm tra các tài nguyên mà nó lên kế hoạch.

Chi tiết

Mô tả gốc của tác giả

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).

repo: google/skills

Độ phổ biến

Sao GitHub
22k
Vị trí xếp hạng
#10290
Giấy phép
Apache-2.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự