@@ -516,63 +516,40 @@ See [Configure a kubelet image credential provider](/docs/tasks/administer-clust
516
516
The interpretation of `config.json` varies between the original Docker
517
517
implementation and the Kubernetes interpretation. In Docker, the `auths` keys
518
518
can only specify root URLs, whereas Kubernetes allows glob URLs as well as
519
- prefix-matched paths. This means that a `config.json` like this is valid:
519
+ prefix-matched paths. The only limitation is that glob patterns (`*`) have to
520
+ include the dot (`.`) for each subdomain. The amount of matched subdomains has
521
+ to be equal to the amount of glob patterns (`*.`), for example:
520
522
-->
521
523
对于 ` config.json ` 的解释在原始 Docker 实现和 Kubernetes 的解释之间有所不同。
522
- 在 Docker 中,` auths ` 键只能指定根 URL,而 Kubernetes 允许 glob URLs 以及前缀匹配的路径。
524
+ 在 Docker 中,` auths ` 键只能指定根 URL,而 Kubernetes 允许 glob URL 以及前缀匹配的路径。
525
+ 唯一的限制是 glob 模式(` * ` )必须为每个子域名包括点(` . ` )。
526
+ 匹配的子域名数量必须等于 glob 模式(` *. ` )的数量,例如:
527
+
528
+ <!--
529
+ - `*.kubernetes.io` will *not* match `kubernetes.io`, but `abc.kubernetes.io`
530
+ - `*.*.kubernetes.io` will *not* match `abc.kubernetes.io`, but `abc.def.kubernetes.io`
531
+ - `prefix.*.io` will match `prefix.kubernetes.io`
532
+ - `*-good.kubernetes.io` will match `prefix-good.kubernetes.io`
533
+ -->
534
+ - ` *.kubernetes.io ` ** 不** 会匹配 ` kubernetes.io ` ,但会匹配 ` abc.kubernetes.io `
535
+ - ` *.*.kubernetes.io ` ** 不** 会匹配 ` abc.kubernetes.io ` ,但会匹配 ` abc.def.kubernetes.io `
536
+ - ` prefix.*.io ` 将匹配 ` prefix.kubernetes.io `
537
+ - ` *-good.kubernetes.io ` 将匹配 ` prefix-good.kubernetes.io `
538
+
539
+ <!--
540
+ This means that a `config.json` like this is valid:
541
+ -->
523
542
这意味着,像这样的 ` config.json ` 是有效的:
524
543
525
544
``` json
526
545
{
527
546
"auths" : {
528
- "*my-registry.io/images" : {
529
- "auth" : " …"
530
- }
547
+ "my-registry.io/images" : { "auth" : " …" },
548
+ "*.my-registry.io/images" : { "auth" : " …" }
531
549
}
532
550
}
533
551
```
534
552
535
- <!--
536
- The root URL (`*my-registry.io`) is matched by using the following syntax:
537
-
538
- ```
539
- pattern:
540
- { term }
541
-
542
- term:
543
- '*' matches any sequence of non-Separator characters
544
- '?' matches any single non-Separator character
545
- '[' [ '^' ] { character-range } ']'
546
- character class (must be non-empty)
547
- c matches character c (c != '*', '?', '\\', '[')
548
- '\\' c matches character c
549
-
550
- character-range:
551
- c matches character c (c != '\\', '-', ']')
552
- '\\' c matches character c
553
- lo '-' hi matches character c for lo <= c <= hi
554
- ```
555
- -->
556
- 使用以下语法匹配根 URL (` *my-registry.io ` ):
557
-
558
- ```
559
- pattern:
560
- { term }
561
-
562
- term:
563
- '*' 匹配任何无分隔符字符序列
564
- '?' 匹配任意单个非分隔符
565
- '[' [ '^' ] 字符范围
566
- 字符集(必须非空)
567
- c 匹配字符 c (c 不为 '*', '?', '\\', '[')
568
- '\\' c 匹配字符 c
569
-
570
- 字符范围:
571
- c 匹配字符 c (c 不为 '\\', '?', '-', ']')
572
- '\\' c 匹配字符 c
573
- lo '-' hi 匹配字符范围在 lo 到 hi 之间字符
574
- ```
575
-
576
553
<!--
577
554
Image pull operations would now pass the credentials to the CRI container
578
555
runtime for every valid pattern. For example the following container image names
@@ -584,13 +561,20 @@ would match successfully:
584
561
- ` my-registry.io/images/my-image `
585
562
- ` my-registry.io/images/another-image `
586
563
- ` sub.my-registry.io/images/my-image `
564
+
565
+ <!--
566
+ But not:
567
+ -->
568
+ 但这些不会匹配成功:
569
+
587
570
- ` a.sub.my-registry.io/images/my-image `
571
+ - ` a.b.sub.my-registry.io/images/my-image `
588
572
589
573
<!--
590
574
The kubelet performs image pulls sequentially for every found credential. This
591
- means, that multiple entries in `config.json` are possible, too:
575
+ means, that multiple entries in `config.json` for different paths are possible, too:
592
576
-->
593
- kubelet 为每个找到的凭据的镜像按顺序拉取。这意味着在 ` config.json ` 中可能有多项 :
577
+ kubelet 为每个找到的凭据的镜像按顺序拉取。这意味着对于不同的路径在 ` config.json ` 中也可能有多项 :
594
578
595
579
``` json
596
580
{
@@ -697,7 +681,7 @@ kubectl create secret docker-registry <name> \
697
681
<!--
698
682
If you already have a Docker credentials file then, rather than using the above
699
683
command, you can import the credentials file as a Kubernetes
700
- {{< glossary_tooltip text="Secrets" term_id="secret" >}}.
684
+ {{< glossary_tooltip text="Secrets" term_id="secret" >}}.
701
685
[Create a Secret based on existing Docker credentials](/docs/tasks/configure-pod-container/pull-image-private-registry/#registry-secret-existing-credentials)
702
686
explains how to set this up.
703
687
-->
@@ -774,8 +758,7 @@ will be merged.
774
758
-->
775
759
你需要对使用私有仓库的每个 Pod 执行以上操作。不过,
776
760
设置该字段的过程也可以通过为[ 服务账号] ( /zh-cn/docs/tasks/configure-pod-container/configure-service-account/ ) 资源设置
777
- ` imagePullSecrets ` 来自动完成。
778
- 有关详细指令,
761
+ ` imagePullSecrets ` 来自动完成。有关详细指令,
779
762
可参见[ 将 ImagePullSecrets 添加到服务账号] ( /zh-cn/docs/tasks/configure-pod-container/configure-service-account/#add-imagepullsecrets-to-a-service-account ) 。
780
763
781
764
你也可以将此方法与节点级别的 ` .docker/config.json ` 配置结合使用。
@@ -830,8 +813,9 @@ common use cases and suggested solutions.
830
813
- Move sensitive data into a "Secret" resource, instead of packaging it in an image.
831
814
-->
832
815
3 . 集群使用专有镜像,且有些镜像需要更严格的访问控制
833
- - 确保 [ AlwaysPullImages 准入控制器] ( /zh-cn/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages ) 被启用。否则,所有 Pod 都可以使用所有镜像。
834
- - 确保将敏感数据存储在 Secret 资源中,而不是将其打包在镜像里
816
+ - 确保 [ AlwaysPullImages 准入控制器] ( /zh-cn/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages ) 被启用。
817
+ 否则,所有 Pod 都可以使用所有镜像。
818
+ - 确保将敏感数据存储在 Secret 资源中,而不是将其打包在镜像里。
835
819
836
820
<!--
837
821
1. A multi-tenant cluster where each tenant needs own private registry.
@@ -843,10 +827,11 @@ common use cases and suggested solutions.
843
827
- The tenant adds that secret to imagePullSecrets of each namespace.
844
828
-->
845
829
4 . 集群是多租户的并且每个租户需要自己的私有仓库
846
- - 确保 [ AlwaysPullImages 准入控制器] ( /zh-cn/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages ) 。否则,所有租户的所有的 Pod 都可以使用所有镜像。
847
- - 为私有仓库启用鉴权
830
+ - 确保 [ AlwaysPullImages 准入控制器] ( /zh-cn/docs/reference/access-authn-authz/admission-controllers/#alwayspullimages ) 。
831
+ 否则,所有租户的所有的 Pod 都可以使用所有镜像。
832
+ - 为私有仓库启用鉴权。
848
833
- 为每个租户生成访问仓库的凭据,放置在 Secret 中,并将 Secret 发布到各租户的名字空间下。
849
- - 租户将 Secret 添加到每个名字空间中的 imagePullSecrets
834
+ - 租户将 Secret 添加到每个名字空间中的 imagePullSecrets。
850
835
851
836
<!--
852
837
If you need access to multiple registries, you can create one secret for each registry.
@@ -859,7 +844,7 @@ If you need access to multiple registries, you can create one secret for each re
859
844
In older versions of Kubernetes, the kubelet had a direct integration with cloud provider credentials.
860
845
This gave it the ability to dynamically fetch credentials for image registries.
861
846
-->
862
- ## 旧版的内置 kubelet 凭据提供程序
847
+ ## 旧版的内置 kubelet 凭据提供程序 {#legacy-built-in-kubelet-credentials-provider}
863
848
864
849
在旧版本的 Kubernetes 中,kubelet 与云提供商凭据直接集成。
865
850
这使它能够动态获取镜像仓库的凭据。
@@ -869,7 +854,7 @@ There were three built-in implementations of the kubelet credential provider int
869
854
ACR (Azure Container Registry), ECR (Elastic Container Registry), and GCR (Google Container Registry).
870
855
-->
871
856
kubelet 凭据提供程序集成存在三个内置实现:
872
- ACR(Azure 容器仓库)、ECR(Elastic 容器仓库)和 GCR(Google 容器仓库)
857
+ ACR(Azure 容器仓库)、ECR(Elastic 容器仓库)和 GCR(Google 容器仓库)。
873
858
874
859
<!--
875
860
For more information on the legacy mechanism, read the documentation for the version of Kubernetes that you
0 commit comments