Skip to content

Commit dadaef2

Browse files
committed
fix: Modify the namespace entry name and refine yaml
1 parent 811b6e2 commit dadaef2

2 files changed

Lines changed: 33 additions & 31 deletions

File tree

docs/en/client/java-sdk-user-guide.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -421,11 +421,9 @@ The configuration methods, in descending order of priority, are
421421
422422
Starting from version 2.4.0, the availability of the client in the Kubernetes environment has been enhanced. After enabling the ConfigMap cache, the client will cache a copy of the configuration information fetched from the server in the ConfigMap. In the case of service unavailability, network issues, and loss of local cache files, the configuration can still be restored from the ConfigMap. Here are the relevant configurations:
423423

424-
> Since read and write operations on the ConfigMap are required, the pod where the client is located must have the corresponding permissions. The specific configuration method can be referred to below.
425-
426424
`apollo.cache.kubernetes.enable`:Whether to enable the ConfigMap cache mechanism, the default is false.
427425

428-
`apollo.configmap-namespace`:The namespace of the ConfigMap to be used (the namespace in Kubernetes), the default value is "default".
426+
`apollo.cache.kubernetes.configmap-namespace`:The namespace of the ConfigMap to be used (the namespace in Kubernetes), the default value is "default".
429427

430428
The configuration information will be placed in the specified ConfigMap according to the following correspondence:
431429

@@ -443,42 +441,44 @@ value: The content is the JSON format string of the corresponding configuration
443441
>
444442
> namespace is the configuration namespace used by the application, which is generally application
445443
446-
How to authorize a Pod's Service Account to have read and write permissions for ConfigMap:
444+
> Since read and write operations on the ConfigMap are required, the pod where the client is located must have the corresponding permissions. The specific configuration method can be referred to below.
447445
446+
How to authorize a Pod's Service Account to have read and write permissions for ConfigMap:
448447

449448
1. Create a Service Account: If there is no Service Account, you need to create one.
450-
```apiVersion: v1
449+
```
450+
apiVersion: v1
451451
kind: ServiceAccount
452452
metadata:
453453
name: my-service-account
454-
namespace: my-namespace
454+
namespace: default
455455
```
456456
2. Create a Role or ClusterRole: Define a Role or ClusterRole to grant read and write permissions for a specific ConfigMap. If the ConfigMap is used across multiple Namespaces, a ClusterRole should be used.
457457
```
458458
apiVersion: rbac.authorization.k8s.io/v1
459459
kind: Role
460460
metadata:
461-
namespace: my-namespace
462-
name: configmap-reader
461+
namespace: default
462+
name: configmap-role
463463
rules:
464464
- apiGroups: [""]
465465
resources: ["configmaps"]
466-
verbs: ["get", "watch", "list", "update", "patch"]
466+
verbs: ["get", "list", "watch", "create", "update", "delete"]
467467
```
468468
3. Bind the Service Account to the Role or ClusterRole: Use RoleBinding or ClusterRoleBinding to bind the Service Account to the Role or ClusterRole created above.
469469
```
470470
apiVersion: rbac.authorization.k8s.io/v1
471471
kind: RoleBinding
472472
metadata:
473-
name: configmap-reader-binding
474-
namespace: my-namespace
473+
name: configmap-reader-binding
474+
namespace: dafault
475475
subjects:
476476
- kind: ServiceAccount
477477
name: my-service-account
478-
namespace: my-namespace
479-
roleRef:
478+
namespace: dafault
479+
roleRef:
480480
kind: Role
481-
name: configmap-reader
481+
name: configmap-role
482482
apiGroup: rbac.authorization.k8s.io
483483
```
484484
4. Specify the Service Account in the Pod configuration: Ensure that the Pod's configuration uses the Service Account created above.
@@ -487,7 +487,7 @@ How to authorize a Pod's Service Account to have read and write permissions for
487487
kind: Pod
488488
metadata:
489489
name: my-pod
490-
namespace: my-namespace
490+
namespace: default
491491
spec:
492492
serviceAccountName: my-service-account
493493
containers:

docs/zh/client/java-sdk-user-guide.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ request.timeout=2000
163163
batch=2000
164164
```
165165

166-
> 注:部署在Kubernetes环境使用configmap缓存模式时,也会同时开启本地文件缓存以进一步提高可用性
166+
> 注:如果部署在Kubernetes环境中,您还可以启用configMap缓存来进一步提高可用性
167167
168168
#### 1.2.3.1 自定义缓存路径
169169

@@ -406,11 +406,9 @@ apollo.label=YOUR-APOLLO-LABEL
406406
407407
在2.4.0版本开始,客户端在Kubernetes环境下的可用性得到了加强,开启configMap缓存后,客户端会将从服务端拉取到的配置信息在configMap中缓存一份,在服务不可用,或网络不通,且本地缓存文件丢失的情况下,依然能从configMap恢复配置。以下是相关配置
408408

409-
> 由于需要对configmap进行读写操作,所以客户端所在pod必须有相应读写权限,具体配置方法可参考下文
410-
411-
`apollo.cache.kubernetes.enable`:是否启动configMap缓存机制,默认false
409+
`apollo.cache.kubernetes.enable`:是否开启configMap缓存机制,默认false
412410

413-
`apollo.configmap-namespace`:将使用的configMap所在的namespace(Kubernetes中的namespace),默认值为"default"
411+
`apollo.cache.kubernetes.configmap-namespace`:将使用的configMap所在的namespace(Kubernetes中的namespace),默认值为"default"
414412

415413
配置信息会以下面的对应关系放置于指定的configmap中:
416414

@@ -427,41 +425,45 @@ value:内容为对应的配置信息的json格式字符串
427425
> cluster是应用使用的集群,一般在本地模式下没有做过配置的话,是default
428426
> namespace就是应用使用的配置namespace,一般是application
429427
428+
> 由于需要对configmap进行读写操作,所以客户端所在pod必须有相应读写权限,具体配置方法可参考下文
429+
430430
如何授权一个Pod的Service Account具有对ConfigMap的读写权限:
431431
1. 创建Service Account: 如果还没有Service Account,你需要创建一个。
432-
```apiVersion: v1
432+
```
433+
apiVersion: v1
433434
kind: ServiceAccount
434435
metadata:
435436
name: my-service-account
436-
namespace: my-namespace
437+
namespace: default
437438
```
438439
2. 创建Role或ClusterRole: 定义一个Role或ClusterRole,授予对特定ConfigMap的读写权限。如果ConfigMap是跨多个Namespace使用的,应该使用ClusterRole。
439440

440441
```
441442
apiVersion: rbac.authorization.k8s.io/v1
442443
kind: Role
443444
metadata:
444-
namespace: my-namespace
445-
name: configmap-reader
445+
namespace: default
446+
name: configmap-role
446447
rules:
447448
- apiGroups: [""]
448449
resources: ["configmaps"]
449-
verbs: ["get", "watch", "list", "update", "patch"]
450+
verbs: ["get", "list", "watch", "create", "update", "delete"]
450451
```
452+
451453
3. 绑定Service Account到Role或ClusterRole: 使用RoleBinding或ClusterRoleBinding将Service Account绑定到上面创建的Role或ClusterRole。
452454
```
453455
apiVersion: rbac.authorization.k8s.io/v1
454456
kind: RoleBinding
455457
metadata:
456-
name: configmap-reader-binding
457-
namespace: my-namespace
458+
name: configmap-reader-binding
459+
namespace: dafault
458460
subjects:
459461
- kind: ServiceAccount
460462
name: my-service-account
461-
namespace: my-namespace
462-
roleRef:
463+
namespace: dafault
464+
roleRef:
463465
kind: Role
464-
name: configmap-reader
466+
name: configmap-role
465467
apiGroup: rbac.authorization.k8s.io
466468
```
467469
4. 在Pod配置中指定Service Account: 确保Pod的配置中使用了上面创建的Service Account。
@@ -470,7 +472,7 @@ value:内容为对应的配置信息的json格式字符串
470472
kind: Pod
471473
metadata:
472474
name: my-pod
473-
namespace: my-namespace
475+
namespace: default
474476
spec:
475477
serviceAccountName: my-service-account
476478
containers:

0 commit comments

Comments
 (0)