@@ -153,8 +153,7 @@ services.
153
153
-->
154
154
在许多情况下,同一组织可能在不同的上下文中使用“租户”的两种定义。
155
155
例如,一个平台团队可能向多个内部“客户”提供安全工具和数据库等共享服务,
156
- 而 SaaS 供应商也可能让多个团队共享一个开发集群。
157
- 最后,混合架构也是可能的,
156
+ 而 SaaS 供应商也可能让多个团队共享一个开发集群。最后,混合架构也是可能的,
158
157
例如,某 SaaS 提供商为每个客户的敏感数据提供独立的工作负载,同时提供多租户共享的服务。
159
158
160
159
<!--
@@ -276,7 +275,7 @@ key dimensions:
276
275
-->
277
276
2 . 许多 Kubernetes 安全策略的作用域是命名空间。
278
277
例如,RBAC Role 和 NetworkPolicy 是命名空间作用域的资源。
279
- 使用 RBAC,可以将用户和服务帐户限制在一个命名空间中 。
278
+ 使用 RBAC,可以将用户账号和服务账号限制在一个命名空间中 。
280
279
281
280
<!--
282
281
In a multi-tenant environment, a Namespace helps segment a tenant's workload into a logical and
@@ -295,8 +294,7 @@ networking plugins, and adherence to security best practices to properly isolate
295
294
These considerations are discussed below.
296
295
-->
297
296
命名空间隔离模型需要配置其他几个 Kubernetes 资源、网络插件,
298
- 并遵守安全最佳实践以正确隔离租户工作负载。
299
- 这些考虑将在下面讨论。
297
+ 并遵守安全最佳实践以正确隔离租户工作负载。这些考虑将在下面讨论。
300
298
301
299
<!--
302
300
### Access controls
@@ -325,7 +323,7 @@ application; similar objects exist for authorizing access to cluster-level objec
325
323
are less useful for multi-tenant clusters.
326
324
327
325
-->
328
- 基于角色的访问控制 (RBAC) 通常用于在 Kubernetes 控制平面中对用户和工作负载(服务帐户 )强制执行鉴权。
326
+ 基于角色的访问控制 (RBAC) 通常用于在 Kubernetes 控制平面中对用户和工作负载(服务账号 )强制执行鉴权。
329
327
[ 角色] ( /zh-cn/docs/reference/access-authn-authz/rbac/#role-and-clusterrole )
330
328
和[ 角色绑定] ( /zh-cn/docs/reference/access-authn-authz/rbac/#rolebinding-and-clusterrolebinding ) 是两种
331
329
Kubernetes 对象,用来在命名空间级别对应用实施访问控制;
@@ -368,7 +366,7 @@ control plane.
368
366
Kubernetes 工作负载消耗节点资源,例如 CPU 和内存。在多租户环境中,
369
367
你可以使用[ 资源配额] ( /zh-cn/docs/concepts/policy/resource-quotas/ ) 来管理租户工作负载的资源使用情况。
370
368
对于多团队场景,各个租户可以访问 Kubernetes API,你可以使用资源配额来限制租户可以创建的 API 资源的数量
371
- (例如:Pod 的数量,或 ConfigMap 的数量)。
369
+ (例如:Pod 的数量或 ConfigMap 的数量)。
372
370
对对象计数的限制确保了公平性,并有助于避免** 嘈杂邻居** 问题影响共享控制平面的其他租户。
373
371
374
372
<!--
@@ -379,8 +377,7 @@ Kubernetes quotas only apply within a single namespace, some namespace managemen
379
377
groups of namespaces to share quotas, giving administrators far more flexibility with less effort
380
378
than built-in quotas.
381
379
-->
382
- 资源配额是命名空间作用域的对象。
383
- 通过将租户映射到命名空间,
380
+ 资源配额是命名空间作用域的对象。通过将租户映射到命名空间,
384
381
集群管理员可以使用配额来确保租户不能垄断集群的资源或压垮控制平面。
385
382
命名空间管理工具简化了配额的管理。
386
383
此外,虽然 Kubernetes 配额仅针对单个命名空间,
@@ -403,8 +400,7 @@ either be throttled or killed, based on the resource type. When resource request
403
400
than limits, each container is guaranteed the requested amount but there may still be some
404
401
potential for impact across workloads.
405
402
-->
406
- 当你对命名空间应用配额时,
407
- Kubernetes 要求你还为每个容器指定资源请求和限制。
403
+ 当你对命名空间应用配额时,Kubernetes 要求你还为每个容器指定资源请求和限制。
408
404
限制是容器可以消耗的资源量的上限。
409
405
根据资源类型,尝试使用超出配置限制的资源的容器将被限制或终止。
410
406
当资源请求设置为低于限制时,
@@ -458,13 +454,11 @@ Kubernetes networking.
458
454
-->
459
455
Pod 之间的通信可以使用[ 网络策略] ( /zh-cn/docs/concepts/services-networking/network-policies/ ) 来控制,
460
456
它使用命名空间标签或 IP 地址范围来限制 Pod 之间的通信。
461
- 在需要租户之间严格网络隔离的多租户环境中,
462
- 建议从拒绝 Pod 之间通信的默认策略入手,
457
+ 在需要租户之间严格网络隔离的多租户环境中,建议从拒绝 Pod 之间通信的默认策略入手,
463
458
然后添加一条允许所有 Pod 查询 DNS 服务器以进行名称解析的规则。
464
459
有了这样的默认策略之后,你就可以开始添加允许在命名空间内进行通信的更多规则。
465
460
另外建议不要在网络策略定义中对 namespaceSelector 字段使用空标签选择算符 “{}”,
466
- 以防需要允许在命名空间之间传输流量。
467
- 该方案可根据需要进一步细化。
461
+ 以防需要允许在命名空间之间传输流量。该方案可根据需要进一步细化。
468
462
请注意,这仅适用于单个控制平面内的 Pod;
469
463
属于不同虚拟控制平面的 Pod 不能通过 Kubernetes 网络相互通信。
470
464
@@ -500,8 +494,7 @@ However, they can be significantly more complex to manage and may not be appropr
500
494
这些更高层次的策略可以更轻松地管理基于命名空间的多租户,
501
495
尤其是存在多个命名空间专用于某一个租户时。
502
496
服务网格还经常使用双向 TLS 提供加密能力,
503
- 即使在存在受损节点的情况下也能保护你的数据,
504
- 并且可以跨专用或虚拟集群工作。
497
+ 即使在存在受损节点的情况下也能保护你的数据,并且可以跨专用或虚拟集群工作。
505
498
但是,它们的管理可能要复杂得多,并且可能并不适合所有用户。
506
499
507
500
<!--
@@ -553,8 +546,6 @@ to ensure that a PersistentVolume cannot be reused across different namespaces.
553
546
-->
554
547
### 沙箱容器 {#sandboxing-containers}
555
548
556
- {{% thirdparty-content %}}
557
-
558
549
<!--
559
550
Kubernetes pods are composed of one or more containers that execute on worker nodes.
560
551
Containers utilize OS-level virtualization and hence offer a weaker isolation boundary than
@@ -572,8 +563,7 @@ the ability to upload and execute untrusted scripts or code. In either case, mec
572
563
isolate and protect workloads using strong isolation are desirable.
573
564
-->
574
565
在共享环境中,攻击者可以利用应用和系统层中未修补的漏洞实现容器逃逸和远程代码执行,
575
- 从而允许访问主机资源。
576
- 在某些应用中,例如内容管理系统(CMS),
566
+ 从而允许访问主机资源。在某些应用中,例如内容管理系统(CMS),
577
567
客户可能被授权上传和执行非受信的脚本或代码。
578
568
无论哪种情况,都需要使用强隔离进一步隔离和保护工作负载的机制。
579
569
@@ -594,30 +584,17 @@ access to the host system and all the processes/files running on that host.
594
584
它通常涉及在单独的执行环境(例如虚拟机或用户空间内核)中运行每个 Pod。
595
585
当你运行不受信任的代码时(假定工作负载是恶意的),通常建议使用沙箱,
596
586
这种隔离是必要的,部分原因是由于容器是在共享内核上运行的进程。
597
- 它们从底层主机挂载像 /sys 和 /proc 这样的文件系统,
587
+ 它们从底层主机挂载像 ` /sys ` 和 ` /proc ` 这样的文件系统,
598
588
这使得它们不如在具有自己内核的虚拟机上运行的应用安全。
599
589
虽然 seccomp、AppArmor 和 SELinux 等控件可用于加强容器的安全性,
600
590
但很难将一套通用规则应用于在共享集群中运行的所有工作负载。
601
591
在沙箱环境中运行工作负载有助于将主机隔离开来,不受容器逃逸影响,
602
592
在容器逃逸场景中,攻击者会利用漏洞来访问主机系统以及在该主机上运行的所有进程/文件。
603
593
604
594
<!--
605
- Virtual machines and userspace kernels are two popular approaches to sandboxing. The following
606
- sandboxing implementations are available:
607
-
608
- * [gVisor](https://gvisor.dev/) intercepts syscalls from containers and runs them through a
609
- userspace kernel, written in Go, with limited access to the underlying host.
610
- * [Kata Containers](https://katacontainers.io/) provide a secure container runtime that allows you to run
611
- containers in a VM. The hardware virtualization available in Kata offers an added layer of
612
- security for containers running untrusted code.
595
+ Virtual machines and userspace kernels are two popular approaches to sandboxing.
613
596
-->
614
597
虚拟机和用户空间内核是两种流行的沙箱方法。
615
- 可以使用以下沙箱实现:
616
-
617
- * [ gVisor] ( https://gvisor.dev/ ) 拦截来自容器的系统调用,并通过用户空间内核运行它们,
618
- 用户空间内核采用 Go 编写,对底层主机的访问是受限的
619
- * [ Kata Containers] ( https://katacontainers.io/ ) 提供了一个安全的容器运行时,
620
- 允许你在 VM 中运行容器。Kata 中提供的硬件虚拟化为运行不受信任代码的容器提供了额外的安全层。
621
598
622
599
<!--
623
600
### Node Isolation
@@ -673,11 +650,9 @@ specific set of nodes designated for that tenant.
673
650
以便它们在为该租户指定的一组特定节点上运行。
674
651
675
652
<!--
676
- Node isolation can be implemented using an [pod node selectors](/docs/concepts/scheduling-eviction/assign-pod-node/)
677
- or a [Virtual Kubelet](https://github.com/virtual-kubelet).
653
+ Node isolation can be implemented using [pod node selectors](/docs/concepts/scheduling-eviction/assign-pod-node/).
678
654
-->
679
- 节点隔离可以使用[ 将 Pod 指派给节点] ( /zh-cn/docs/concepts/scheduling-eviction/assign-pod-node/ ) 或
680
- [ Virtual Kubelet] ( https://github.com/virtual-kubelet ) 来实现。
655
+ 节点隔离可以使用[ 将 Pod 指派给节点] ( /zh-cn/docs/concepts/scheduling-eviction/assign-pod-node/ ) 来实现。
681
656
682
657
<!--
683
658
## Additional Considerations
@@ -785,10 +760,7 @@ this feature.
785
760
如果你有一个用例,其中租户在共享集群中具有不同的服务层,例如免费和付费,
786
761
你可能希望使用此功能为某些层级提供更高的优先级。
787
762
788
- <!--
789
763
### DNS
790
- -->
791
- ### DNS {#dns}
792
764
793
765
<!--
794
766
Kubernetes clusters include a Domain Name System (DNS) service to provide translations from names
@@ -827,10 +799,7 @@ that supports multiple tenants.
827
799
必须为每个租户配置 DNS 服务或必须使用多租户 DNS 服务。参见一个
828
800
[ CoreDNS 的定制版本] ( https://github.com/kubernetes-sigs/cluster-api-provider-nested/blob/main/virtualcluster/doc/tenant-dns.md ) 支持多租户的示例。
829
801
830
- <!--
831
802
### Operators
832
- -->
833
- ### Operators {#operators}
834
803
835
804
<!--
836
805
[Operators](/docs/concepts/extend-kubernetes/operator/) are Kubernetes controllers that manage
@@ -863,8 +832,6 @@ Specifically, the Operator should:
863
832
-->
864
833
## 实现 {#implementations}
865
834
866
- {{% thirdparty-content %}}
867
-
868
835
<!--
869
836
There are two primary ways to share a Kubernetes cluster for multi-tenancy: using Namespaces
870
837
(that is, a Namespace per tenant) or by virtualizing the control plane (that is, virtual control
@@ -939,8 +906,7 @@ customize policies to individual workloads, and secondly, it may be challenging
939
906
single level of "tenancy" that should be given a namespace. For example, an organization may have
940
907
divisions, teams, and subteams - which should be assigned a namespace?
941
908
-->
942
- 相反,在租户级别分配命名空间也有优势,
943
- 而不仅仅是工作负载级别,
909
+ 相反,在租户级别分配命名空间也有优势,而不仅仅是工作负载级别,
944
910
因为通常有一些策略适用于单个租户拥有的所有工作负载。
945
911
然而,这种方案也有自己的问题。
946
912
首先,这使得为各个工作负载定制策略变得困难或不可能,
@@ -957,55 +923,6 @@ be useful in both multi-team and multi-customer scenarios.
957
923
这可以包括管理命名空间标签、命名空间生命周期、委托访问权限,以及在相关命名空间之间共享资源配额。
958
924
这些功能在多团队和多客户场景中都很有用。
959
925
960
- <!--
961
- Some third-party projects that provide capabilities like this and aid in managing namespaced resources are
962
- listed below.
963
- -->
964
- 下面列出了提供类似功能并有助于管理命名空间资源的一些第三方项目:
965
-
966
- {{% thirdparty-content %}}
967
-
968
- <!--
969
- #### Multi-team tenancy
970
- -->
971
- #### 多团队租户 {#multi-team-tenancy}
972
-
973
- {{% thirdparty-content %}}
974
-
975
- <!--
976
- * [Capsule](https://github.com/clastix/capsule)
977
- * [Multi Tenant Operator](https://docs.stakater.com/mto/)
978
- -->
979
- * [ Capsule] ( https://github.com/clastix/capsule )
980
- * [ Multi Tenant Operator] ( https://docs.stakater.com/mto/ )
981
-
982
- <!--
983
- #### Multi-customer tenancy
984
- -->
985
- #### 多客户租户 {#multi-customer-tenancy}
986
-
987
- <!--
988
- * [Kubeplus](https://github.com/cloud-ark/kubeplus)
989
- -->
990
- * [ Kubeplus] ( https://github.com/cloud-ark/kubeplus )
991
-
992
- <!--
993
- #### Policy engines
994
- -->
995
- #### 策略引擎 {#policy-engines}
996
-
997
- <!--
998
- Policy engines provide features to validate and generate tenant configurations:
999
- -->
1000
- 策略引擎提供了验证和生成租户配置的特性:
1001
-
1002
- <!--
1003
- * [Kyverno](https://kyverno.io/)
1004
- * [OPA/Gatekeeper](https://github.com/open-policy-agent/gatekeeper)
1005
- -->
1006
- * [ Kyverno] ( https://kyverno.io/ )
1007
- * [ OPA/Gatekeeper] ( https://github.com/open-policy-agent/gatekeeper )
1008
-
1009
926
<!--
1010
927
### Virtual control plane per tenant
1011
928
-->
@@ -1072,19 +989,3 @@ These must still be addressed separately.
1072
989
改进的隔离是以每个租户运行和维护一个单独的虚拟控制平面为代价的。
1073
990
此外,租户层面的控制面不能解决数据面的隔离问题,
1074
991
例如节点级的嘈杂邻居或安全威胁。这些仍然必须单独解决。
1075
-
1076
- <!--
1077
-
1078
- The Kubernetes [Cluster API - Nested (CAPN)](https://github.com/kubernetes-sigs/cluster-api-provider-nested/tree/main/virtualcluster)
1079
- project provides an implementation of virtual control planes.
1080
- -->
1081
- Kubernetes [ Cluster API - Nested (CAPN)] ( https://github.com/kubernetes-sigs/cluster-api-provider-nested/tree/main/virtualcluster )
1082
- 项目提供了虚拟控制平面的实现。
1083
-
1084
- <!--
1085
- #### Other implementations
1086
- -->
1087
- #### 其他实现 {#other-implementations}
1088
-
1089
- * [ Kamaji] ( https://github.com/clastix/kamaji )
1090
- * [ vcluster] ( https://github.com/loft-sh/vcluster )
0 commit comments