Skip to content

Commit 4867287

Browse files
authored
Merge pull request #40466 from ydFu/zh-uadate-k8s-v126
[zh-cn]Update blog: Kubernetes v1.26: Retroactive Default StorageClass
2 parents 23d7e45 + c113376 commit 4867287

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

content/zh-cn/blog/_posts/2023-01-05-retroactive-default-storage-class.md

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
layout: blog
3-
title: "Kubernetes 1.26:可追溯的默认 StorageClass"
3+
title: "Kubernetes v1.26:可追溯的默认 StorageClass"
44
date: 2023-01-05
55
slug: retroactive-default-storage-class
66
---
77
<!--
88
layout: blog
9-
title: "Kubernetes 1.26: Retroactive Default StorageClass"
9+
title: "Kubernetes v1.26: Retroactive Default StorageClass"
1010
date: 2023-01-05
1111
slug: retroactive-default-storage-class
1212
-->
@@ -23,11 +23,11 @@ The v1.25 release of Kubernetes introduced an alpha feature to change how a defa
2323
StorageClass was assigned to a PersistentVolumeClaim (PVC). With the feature enabled,
2424
you no longer need to create a default StorageClass first and PVC second to assign the
2525
class. Additionally, any PVCs without a StorageClass assigned can be updated later.
26-
This feature was graduated to beta in Kubernetes 1.26.
26+
This feature was graduated to beta in Kubernetes v1.26.
2727
-->
2828
Kubernetes v1.25 引入了一个 Alpha 特性来更改默认 StorageClass 被分配到 PersistentVolumeClaim (PVC) 的方式。
2929
启用此特性后,你不再需要先创建默认 StorageClass,再创建 PVC 来分配类。
30-
此外,任何未分配 StorageClass 的 PVC 都可以在后续被更新。此特性在 Kubernetes 1.26 中已进阶至 Beta。
30+
此外,任何未分配 StorageClass 的 PVC 都可以在后续被更新。此特性在 Kubernetes v1.26 中已进阶至 Beta。
3131

3232
<!--
3333
You can read [retroactive default StorageClass assignment](/docs/concepts/storage/persistent-volumes/#retroactive-default-storageclass-assignment)
@@ -247,8 +247,15 @@ If you would like to see the feature in action and verify it works fine in your
247247
2. 在没有默认 StorageClass 时创建 PersistentVolumeClaim。
248248
PVC 不会制备或绑定(除非当前已存在一个合适的 PV),PVC 将保持在 `Pending` 状态。
249249

250+
```shell
251+
kubectl get pvc
250252
```
251-
$ kc get pvc
253+
<!--
254+
The output is similar to this:
255+
-->
256+
257+
输出类似于:
258+
```console
252259
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
253260
pvc-1 Pending
254261
```
@@ -258,8 +265,16 @@ If you would like to see the feature in action and verify it works fine in your
258265
-->
259266
3. 将某个 StorageClass 配置为默认值。
260267

268+
```shell
269+
kubectl patch sc -p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
261270
```
262-
$ kc patch sc -p '{"metadata":{"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
271+
272+
<!--
273+
The output is similar to this:
274+
-->
275+
276+
输出类似于:
277+
```console
263278
storageclass.storage.k8s.io/my-storageclass patched
264279
```
265280

@@ -268,8 +283,16 @@ If you would like to see the feature in action and verify it works fine in your
268283
-->
269284
4. 确认 PersistentVolumeClaims 现在已被正确制备,并且已使用新的默认 StorageClass 进行了可追溯的更新。
270285

286+
```shell
287+
kubectl get pvc
271288
```
272-
$ kc get pvc
289+
290+
<!--
291+
The output is similar to this:
292+
-->
293+
294+
输出类似于:
295+
```console
273296
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
274297
pvc-1 Bound pvc-06a964ca-f997-4780-8627-b5c3bf5a87d8 1Gi RWO my-storageclass 87m
275298
```

0 commit comments

Comments
 (0)