Loading...
Loading...
Compare original and translation side by side
MCP Tools:,apply_k8s_manifest,get_k8s_resource,check_k8s_auth,describe_k8s_resourcedelete_k8s_resource
MCP 工具:,apply_k8s_manifest,get_k8s_resource,check_k8s_auth,describe_k8s_resourcedelete_k8s_resource
| 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.
| 模式 | 隔离度 | 复杂度 | 成本 |
|---|---|---|---|
| 按团队划分命名空间 | 软隔离(RBAC + | 低 | 最低(共享集群) |
| : : 网络策略) : : : | |||
| : : : : : | |||
| 按环境划分命名空间 | 软隔离 | 低 | 低 |
| 按团队划分节点池 | 中等隔离(专用计算资源) | 中等 | 中等 |
| : : : : : | |||
| : : : : : | |||
| 按团队划分集群 | 硬隔离(完全隔离) | 高 | 最高 |
| : : : : : | |||
| : : : : : |
推荐最佳路径:为了成本效益,从按团队划分命名空间开始。仅当合规要求时,才升级到更强的隔离模式。
kubectl create namespace team-a
kubectl create namespace team-b
kubectl label namespace team-a team=a
kubectl label namespace team-b team=bkubectl create namespace team-a
kubectl create namespace team-b
kubectl label namespace team-a team=a
kubectl label namespace team-b team=bsystem:authenticatedundefinedsystem:authenticatedundefined
**RBAC best practices:** Use Google Groups for subject bindings. Prefer
namespace-scoped Roles over ClusterRoles. See the `gke-security` skill for full
RBAC hardening guidance.
**RBAC 最佳实践**:使用Google群组作为主题绑定。优先选择命名空间级Role而非ClusterRole。有关完整的RBAC强化指南,请参阅`gke-security`技能。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"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"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 definingorminlimits in amax, you must also define correspondingLimitRangeanddefaultvalues. If you set adefaultRequestorminwithout defaults, any pod deployed without explicit resource requests/limits will be rejected by the admission controller.max
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] 强制默认值:在中定义LimitRange或min限制时,您必须同时定义对应的max和default值。如果您设置了defaultRequest或min但未设置默认值,任何未明确指定资源请求/限制的Pod都会被准入控制器拒绝。max
gke-securityundefinedgke-securityundefinedundefinedundefinedundefinedundefinedundefinedundefinedgcloud container clusters update <CLUSTER_NAME> --region <REGION> \
--enable-cost-allocationgcloud container clusters update <CLUSTER_NAME> --region <REGION> \
--enable-cost-allocation