You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/zh/docs/tutorials/stateful-application/mysql-wordpress-persistent-volume.md
+30-47Lines changed: 30 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,36 +23,35 @@ card:
23
23
<!--
24
24
This tutorial shows you how to deploy a WordPress site and a MySQL database using Minikube. Both applications use PersistentVolumes and PersistentVolumeClaims to store data.
A [PersistentVolume](/docs/concepts/storage/persistent-volumes/)(PV)is a piece of storage in the cluster that has been manually provisioned by an administrator, or dynamically provisioned by Kubernetes using a [StorageClass](/docs/concepts/storage/storage-classes). A [PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims)(PVC)is a request for storage by a user that can be fulfilled by a PV. PersistentVolumes and PersistentVolumeClaims are independent from Pod lifecycles and preserve data through restarting, rescheduling, and even deleting Pods.
[PersistentVolumeClaim](/zh/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims)(PVC)是一个满足对 PV 存储需要的请求。PersistentVolumes 和 PersistentVolumeClaims 是独立于 Pod 生命周期而在 Pod 重启,重新调度甚至删除过程中保存数据。
PersistentVolumes 和 PersistentVolumeClaims 独立于 Pod 生命周期而存在,
37
+
在 Pod 重启,重新调度甚至删除过程中保存数据。
36
38
37
39
{{< warning >}}
38
40
<!--
39
41
This deployment is not suitable for production use cases, as it uses single instance WordPress and MySQL Pods. Consider using [WordPress Helm Chart](https://github.com/kubernetes/charts/tree/master/stable/wordpress) to deploy WordPress in production.
40
42
-->
41
-
42
-
这种部署并不适合生产场景,它使用单实例 WordPress 和 MySQL Pods。考虑使用 [WordPress Helm Chart](https://github.com/kubernetes/charts/tree/master/stable/wordpress) 在生产场景中部署 WordPress。
The files provided in this tutorial are using GA Deployment APIs and are specific to kubernetes version 1.9 and later. If you wish to use this tutorial with an earlier version of Kubernetes, please update the API version appropriately, or reference earlier versions of this tutorial.
49
51
-->
50
-
51
52
本教程中提供的文件使用 GA Deployment API,并且特定于 kubernetes 1.9 或更高版本。如果你希望将本教程与 Kubernetes 的早期版本一起使用,请相应地更新 API 版本,或参考本教程的早期版本。
52
53
{{< /note >}}
53
54
54
-
55
-
56
55
## {{% heading "objectives" %}}
57
56
58
57
<!--
@@ -64,7 +63,6 @@ This tutorial shows you how to deploy a WordPress site and a MySQL database usin
64
63
* Apply the kustomization directory by `kubectl apply -k ./`
65
64
* Clean up
66
65
-->
67
-
68
66
* 创建 PersistentVolumeClaims 和 PersistentVolumes
69
67
* 创建 `kustomization.yaml` 使用
70
68
* Secret 生成器
@@ -73,11 +71,8 @@ This tutorial shows you how to deploy a WordPress site and a MySQL database usin
73
71
* 应用整个 kustomization 目录 `kubectl apply -k ./`
74
72
* 清理
75
73
76
-
77
-
78
74
## {{% heading "prerequisites" %}}
79
75
80
-
81
76
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
82
77
83
78
<!--
@@ -89,7 +84,6 @@ Download the following configuration files:
## Create PersistentVolumeClaims and PersistentVolumes
107
99
-->
108
-
109
100
## 创建 PersistentVolumeClaims 和 PersistentVolumes
110
-
111
101
<!-- MySQL and Wordpress each require a PersistentVolume to store data. Their PersistentVolumeClaims will be created at the deployment step.
112
102
113
103
Many cluster environments have a default StorageClass installed. When a StorageClass is not specified in the PersistentVolumeClaim, the cluster's default StorageClass is used instead.
114
104
115
105
When a PersistentVolumeClaim is created, a PersistentVolume is dynamically provisioned based on the StorageClass configuration.
116
106
-->
117
107
118
-
MySQL 和 Wordpress 都需要一个 PersistentVolume 来存储数据。他们的 PersistentVolumeClaims 将在部署步骤中创建。
@@ -126,44 +118,47 @@ MySQL 和 Wordpress 都需要一个 PersistentVolume 来存储数据。他们的
126
118
In local clusters, the default StorageClass uses the `hostPath` provisioner. `hostPath` volumes are only suitable for development and testing. With `hostPath` volumes, your data lives in `/tmp` on the node the Pod is scheduled onto and does not move between nodes. If a Pod dies and gets scheduled to another node in the cluster, or the node is rebooted, the data is lost.
127
119
-->
128
120
129
-
在本地集群中,默认的 StorageClass 使用`hostPath`供应器。 `hostPath`卷仅适用于开发和测试。使用 `hostPath` 卷,你的数据位于 Pod 调度到的节点上的`/tmp`中,并且不会在节点之间移动。如果 Pod 死亡并被调度到群集中的另一个节点,或者该节点重新启动,则数据将丢失。
使用 `hostPath` 卷,你的数据位于 Pod 调度到的节点上的`/tmp`中,并且不会在节点之间移动。
123
+
如果 Pod 死亡并被调度到集群中的另一个节点,或者该节点重新启动,则数据将丢失。
130
124
{{< /warning >}}
131
125
132
126
{{< note >}}
133
127
<!--
134
128
If you are bringing up a cluster that needs to use the `hostPath` provisioner, the `--enable-hostpath-provisioner` flag must be set in the `controller-manager` component.
<!-- If you have a Kubernetes cluster running on Google Kubernetes Engine, please follow [this guide](https://cloud.google.com/kubernetes-engine/docs/tutorials/persistent-disk). -->
142
136
143
-
如果你已经有运行在 Google Kubernetes Engine 的集群,请参考 [this guide](https://cloud.google.com/kubernetes-engine/docs/tutorials/persistent-disk)。
A [Secret](/docs/concepts/configuration/secret/) is an object that stores a piece of sensitive data like a password or key. Since 1.14, `kubectl` supports the management of Kubernetes objects using a kustomization file. You can create a Secret by generators in `kustomization.yaml`.
160
153
161
154
Add a Secret generator in `kustomization.yaml` from the following command. You will need to replace `YOUR_PASSWORD` with the password you want to use.
The following manifest describes a single-instance MySQL Deployment. The MySQL container mounts the PersistentVolume at /var/lib/mysql. The `MYSQL_ROOT_PASSWORD` environment variable sets the database password from the Secret.
Do not leave your WordPress installation on this page. If another user finds it, they can set up a website on your instance and use it to serve malicious content. <br/><br/>Either install WordPress by creating a username and password or delete your instance.
@@ -460,18 +447,14 @@ Do not leave your WordPress installation on this page. If another user finds it,
460
447
kubectl delete -k ./
461
448
```
462
449
463
-
464
-
465
450
## {{% heading "whatsnext" %}}
466
451
467
-
468
452
<!--
469
453
* Learn more about [Introspection and Debugging](/docs/tasks/debug/debug-application/debug-running-pod/)
470
454
* Learn more about [Jobs](/docs/concepts/workloads/controllers/jobs-run-to-completion/)
471
455
* Learn more about [Port Forwarding](/docs/tasks/access-application-cluster/port-forward-access-application-cluster/)
472
456
* Learn how to [Get a Shell to a Container](/docs/tasks/debug/debug-application/get-shell-running-container/)
0 commit comments