Skip to content

Commit c038fa8

Browse files
committed
[zh-cn]sync volumes statefulset
Signed-off-by: xin.li <[email protected]>
1 parent 9bd5c21 commit c038fa8

File tree

2 files changed

+96
-25
lines changed

2 files changed

+96
-25
lines changed

content/zh-cn/docs/concepts/storage/volumes.md

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -443,18 +443,10 @@ overlays), the `emptyDir` may run out of capacity before this limit.
443443
如果来自其他来源(如日志文件或镜像分层数据)的数据占满了存储,`emptyDir`
444444
可能会在达到此限制之前发生存储容量不足的问题。
445445

446-
{{< note >}}
447446
<!--
448-
You can specify a size for memory backed volumes, provided that the `SizeMemoryBackedVolumes`
449-
[feature gate](/docs/reference/command-line-tools-reference/feature-gates/)
450-
is enabled in your cluster (this has been beta, and active by default, since the Kubernetes 1.22 release).
451-
If you don't specify a volume size, memory backed volumes are sized to node allocatable memory.
447+
If no size is specified, memory backed volumes are sized to node allocatable memory.
452448
-->
453-
你可以指定内存作为介质的卷的大小,前提是集群中启用了 `SizeMemoryBackedVolumes`
454-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/)
455-
(自 Kubernetes 1.22 发布以来,此特性一直处于 Beta 阶段,并且默认启用)。
456-
如果你未指定大小,内存作为介质的卷的大小根据节点可分配内存进行调整。
457-
{{< /note>}}
449+
如果未指定大小,内存支持的卷将被设置为节点可分配内存的大小。
458450

459451
{{< caution >}}
460452
<!--
@@ -489,6 +481,30 @@ spec:
489481
sizeLimit: 500Mi
490482
```
491483

484+
<!--
485+
#### emptyDir memory configuration example
486+
-->
487+
#### emptyDir 内存配置示例
488+
489+
```yaml
490+
apiVersion: v1
491+
kind: Pod
492+
metadata:
493+
name: test-pd
494+
spec:
495+
containers:
496+
- image: registry.k8s.io/test-webserver
497+
name: test-container
498+
volumeMounts:
499+
- mountPath: /cache
500+
name: cache-volume
501+
volumes:
502+
- name: cache-volume
503+
emptyDir:
504+
sizeLimit: 500Mi
505+
medium: Memory
506+
```
507+
492508
<!--
493509
### fc (fibre channel) {#fc}
494510

@@ -1448,7 +1464,7 @@ must be installed on the cluster.
14481464
(Portworx 的 CSI 迁移自 Kubernetes v1.23 版本以来一直可用,但从 v1.31 版本开始才默认启用)。
14491465
如果你想禁用自动迁移,可以将 `CSIMigrationPortworx`
14501466
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates/) 设置为 `false`;
1451-
你需要在 kube-controller-manager **和** 每个相关的 kubelet 上进行此更改。
1467+
你需要在 kube-controller-manager **和**每个相关的 kubelet 上进行此更改。
14521468

14531469
它将所有插件操作不再指向树内插件(In-Tree Plugin),转而指向
14541470
`pxd.portworx.com` 容器存储接口(Container Storage Interface,CSI)驱动。
@@ -1813,7 +1829,7 @@ CSI 和 FlexVolume 都允许独立于 Kubernetes 代码库开发卷插件,并
18131829
(CSI) defines a standard interface for container orchestration systems (like
18141830
Kubernetes) to expose arbitrary storage systems to their container workloads.
18151831
-->
1816-
[容器存储接口](https://github.com/container-storage-interface/spec/blob/master/spec.md) (CSI)
1832+
[容器存储接口](https://github.com/container-storage-interface/spec/blob/master/spec.md)CSI
18171833
为容器编排系统(如 Kubernetes)定义标准接口,以将任意存储系统暴露给它们的容器工作负载。
18181834

18191835
<!--
@@ -1929,7 +1945,7 @@ persistent volume:
19291945
该映射必须与 CSI 驱动程序返回的 `CreateVolumeResponse` 中的 `volume.attributes`
19301946
字段的映射相对应;
19311947
[CSI 规范](https://github.com/container-storage-interface/spec/blob/master/spec.md#createvolume)中有相应的定义。
1932-
该映射通过`ControllerPublishVolumeRequest`、`NodeStageVolumeRequest` 和
1948+
该映射通过 `ControllerPublishVolumeRequest`、`NodeStageVolumeRequest` 和
19331949
`NodePublishVolumeRequest` 中的 `volume_context` 字段传递给 CSI 驱动。
19341950

19351951
<!--
@@ -1969,8 +1985,8 @@ persistent volume:
19691985
当你为节点初始化的卷扩展配置 Secret 数据时,kubelet 会通过 `NodeExpandVolume()`
19701986
调用将该数据传递给 CSI 驱动。所有受支持的 Kubernetes 版本都提供 `nodeExpandSecretRef` 字段,
19711987
并且默认可用。Kubernetes v1.25 之前的版本不包括此支持。
1972-
为每个 kube-apiserver 和每个节点上的 kubelet 启用名为 `CSINodeExpandSecret`
1973-
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates-removed/)。
1988+
为每个 kube-apiserver 和每个节点上的 kubelet 启用名为 `CSINodeExpandSecret`
1989+
[特性门控](/zh-cn/docs/reference/command-line-tools-reference/feature-gates-removed/)。
19741990
自 Kubernetes 1.27 版本起,此特性已默认启用,无需显式启用特性门控。
19751991
在节点初始化的存储大小调整操作期间,你还必须使用支持或需要 Secret 数据的 CSI 驱动。
19761992

@@ -2165,8 +2181,9 @@ Pod 通过 `flexvolume` 树内插件与 FlexVolume 驱动程序交互。
21652181
The following FlexVolume [plugins](https://github.com/Microsoft/K8s-Storage-Plugins/tree/master/flexvolume/windows),
21662182
deployed as PowerShell scripts on the host, support Windows nodes:
21672183
-->
2168-
下面的 FlexVolume [插件](https://github.com/Microsoft/K8s-Storage-Plugins/tree/master/flexvolume/windows)
2169-
以 PowerShell 脚本的形式部署在宿主机系统上,支持 Windows 节点:
2184+
下面的 FlexVolume
2185+
[插件](https://github.com/Microsoft/K8s-Storage-Plugins/tree/master/flexvolume/windows)以
2186+
PowerShell 脚本的形式部署在宿主机系统上,支持 Windows 节点:
21702187

21712188
* [SMB](https://github.com/microsoft/K8s-Storage-Plugins/tree/master/flexvolume/windows/plugins/microsoft.com~smb.cmd)
21722189
* [iSCSI](https://github.com/microsoft/K8s-Storage-Plugins/tree/master/flexvolume/windows/plugins/microsoft.com~iscsi.cmd)
@@ -2190,12 +2207,12 @@ FlexVolume 用户应迁移工作负载以使用对等的 CSI 驱动。
21902207
## 挂载卷的传播 {#mount-propagation}
21912208

21922209
{{< caution >}}
2193-
<!--
2210+
<!--
21942211
Mount propagation is a low-level feature that does not work consistently on all
21952212
volume types. It is recommended to use only with `hostPath` or in-memory `emptyDir`
21962213
volumes. See [this discussion](https://github.com/kubernetes/kubernetes/issues/95049)
21972214
for more context.
2198-
-->
2215+
-->
21992216
挂载卷的传播是一项底层功能,不能在所有类型的卷中以一致的方式工作。
22002217
建议只在 `hostPath` 或基于内存的 `emptyDir` 卷中使用。
22012218
详情请参考[讨论](https://github.com/kubernetes/kubernetes/issues/95049)。
@@ -2235,7 +2252,7 @@ in `containers[*].volumeMounts`. Its values are:
22352252

22362253
然而,当 `rprivate` 传播选项不适用时,CRI 运行时可以转为选择 `rslave` 挂载传播选项
22372254
(即 `HostToContainer`)。当挂载源包含 Docker 守护进程的根目录(`/var/lib/docker`)时,
2238-
cri-dockerd (Docker) 已知可以选择 `rslave` 挂载传播选项。
2255+
cri-dockerdDocker已知可以选择 `rslave` 挂载传播选项。
22392256

22402257
<!--
22412258
* `HostToContainer` - This volume mount will receive all subsequent mounts

content/zh-cn/docs/concepts/workloads/controllers/statefulset.md

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,59 @@ The example below demonstrates the components of a StatefulSet.
122122

123123
下面的示例演示了 StatefulSet 的组件。
124124

125+
<!--
126+
```yaml
127+
apiVersion: v1
128+
kind: Service
129+
metadata:
130+
name: nginx
131+
labels:
132+
app: nginx
133+
spec:
134+
ports:
135+
- port: 80
136+
name: web
137+
clusterIP: None
138+
selector:
139+
app: nginx
140+
---
141+
apiVersion: apps/v1
142+
kind: StatefulSet
143+
metadata:
144+
name: web
145+
spec:
146+
selector:
147+
matchLabels:
148+
app: nginx # has to match .spec.template.metadata.labels
149+
serviceName: "nginx"
150+
replicas: 3 # by default is 1
151+
minReadySeconds: 10 # by default is 0
152+
template:
153+
metadata:
154+
labels:
155+
app: nginx # has to match .spec.selector.matchLabels
156+
spec:
157+
terminationGracePeriodSeconds: 10
158+
containers:
159+
- name: nginx
160+
image: registry.k8s.io/nginx-slim:0.24
161+
ports:
162+
- containerPort: 80
163+
name: web
164+
volumeMounts:
165+
- name: www
166+
mountPath: /usr/share/nginx/html
167+
volumeClaimTemplates:
168+
- metadata:
169+
name: www
170+
spec:
171+
accessModes: [ "ReadWriteOnce" ]
172+
storageClassName: "my-storage-class"
173+
resources:
174+
requests:
175+
storage: 1Gi
176+
```
177+
-->
125178
```yaml
126179
apiVersion: v1
127180
kind: Service
@@ -436,19 +489,20 @@ the StatefulSet.
436489
-->
437490
### Pod 索引标签 {#pod-index-label}
438491

439-
{{< feature-state for_k8s_version="v1.28" state="beta" >}}
492+
{{< feature-state feature_gate_name="PodIndexLabel" >}}
440493

441494
<!--
442495
When the StatefulSet {{<glossary_tooltip text="controller" term_id="controller">}} creates a Pod,
443496
the new Pod is labelled with `apps.kubernetes.io/pod-index`. The value of this label is the ordinal index of
444497
the Pod. This label allows you to route traffic to a particular pod index, filter logs/metrics
445-
using the pod index label, and more. Note the feature gate `PodIndexLabel` must be enabled for this
446-
feature, and it is enabled by default.
498+
using the pod index label, and more. Note the feature gate `PodIndexLabel` is enabled and locked by default for this
499+
feature, in order to disable it, users will have to use server emulated version v1.31.
447500
-->
448501
当 StatefulSet {{<glossary_tooltip text="控制器" term_id="controller">}}创建一个 Pod 时,
449502
新的 Pod 会被打上 `apps.kubernetes.io/pod-index` 标签。标签的取值为 Pod 的序号索引。
450503
此标签使你能够将流量路由到特定索引值的 Pod、使用 Pod 索引标签来过滤日志或度量值等等。
451-
注意要使用这一特性需要启用特性门控 `PodIndexLabel`,而该门控默认是被启用的。
504+
请注意,默认情况下,特性门 `PodIndexLabel` 已启用并锁定。要禁用它,
505+
用户需要使用服务器模拟版本 v1.31。
452506

453507
<!--
454508
## Deployment and Scaling Guarantees
@@ -698,7 +752,7 @@ StatefulSet 才会开始使用被还原的模板来重新创建 Pod。
698752
-->
699753
## PersistentVolumeClaim 保留 {#persistentvolumeclaim-retention}
700754

701-
{{< feature-state for_k8s_version="v1.27" state="beta" >}}
755+
{{< feature-state feature_gate_name="StatefulSetAutoDeletePVC" >}}
702756

703757
<!--
704758
The optional `.spec.persistentVolumeClaimRetentionPolicy` field controls if

0 commit comments

Comments
 (0)