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
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.
14
+
This tutorial shows you how to deploy a WordPress site and a MySQL database using
15
+
Minikube. Both applications use PersistentVolumes and PersistentVolumeClaims to store data.
15
16
16
-
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.
17
+
A [PersistentVolume](/docs/concepts/storage/persistent-volumes/) (PV) is a piece
18
+
of storage in the cluster that has been manually provisioned by an administrator,
19
+
or dynamically provisioned by Kubernetes using a [StorageClass](/docs/concepts/storage/storage-classes).
20
+
A [PersistentVolumeClaim](/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims) (PVC)
21
+
is a request for storage by a user that can be fulfilled by a PV. PersistentVolumes and
22
+
PersistentVolumeClaims are independent from Pod lifecycles and preserve data through
23
+
restarting, rescheduling, and even deleting Pods.
17
24
18
25
{{< warning >}}
19
-
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/bitnami/charts/tree/master/bitnami/wordpress) to deploy WordPress in production.
26
+
This deployment is not suitable for production use cases, as it uses single instance
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.
33
+
The files provided in this tutorial are using GA Deployment APIs and are specific
34
+
to kubernetes version 1.9 and later. If you wish to use this tutorial with an earlier
35
+
version of Kubernetes, please update the API version appropriately, or reference
36
+
earlier versions of this tutorial.
24
37
{{< /note >}}
25
38
26
-
27
-
28
39
## {{% heading "objectives" %}}
29
40
30
41
* Create PersistentVolumeClaims and PersistentVolumes
@@ -35,12 +46,10 @@ The files provided in this tutorial are using GA Deployment APIs and are specifi
35
46
* Apply the kustomization directory by `kubectl apply -k ./`
36
47
* Clean up
37
48
38
-
39
-
40
49
## {{% heading "prerequisites" %}}
41
50
42
-
43
51
{{< include "task-tutorial-prereqs.md" >}} {{< version-check >}}
52
+
44
53
The example shown on this page works with `kubectl` 1.14 and above.
45
54
46
55
Download the following configuration files:
@@ -49,36 +58,49 @@ Download the following configuration files:
## Create PersistentVolumeClaims and PersistentVolumes
57
64
58
-
MySQL and Wordpress each require a PersistentVolume to store data. Their PersistentVolumeClaims will be created at the deployment step.
65
+
MySQL and Wordpress each require a PersistentVolume to store data.
66
+
Their PersistentVolumeClaims will be created at the deployment step.
59
67
60
-
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.
68
+
Many cluster environments have a default StorageClass installed.
69
+
When a StorageClass is not specified in the PersistentVolumeClaim,
70
+
the cluster's default StorageClass is used instead.
61
71
62
-
When a PersistentVolumeClaim is created, a PersistentVolume is dynamically provisioned based on the StorageClass configuration.
72
+
When a PersistentVolumeClaim is created, a PersistentVolume is dynamically
73
+
provisioned based on the StorageClass configuration.
63
74
64
75
{{< warning >}}
65
-
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.
76
+
In local clusters, the default StorageClass uses the `hostPath` provisioner.
77
+
`hostPath` volumes are only suitable for development and testing. With `hostPath`
78
+
volumes, your data lives in `/tmp` on the node the Pod is scheduled onto and does
79
+
not move between nodes. If a Pod dies and gets scheduled to another node in the
80
+
cluster, or the node is rebooted, the data is lost.
66
81
{{< /warning >}}
67
82
68
83
{{< note >}}
69
-
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.
84
+
If you are bringing up a cluster that needs to use the `hostPath` provisioner,
85
+
the `--enable-hostpath-provisioner` flag must be set in the `controller-manager` component.
70
86
{{< /note >}}
71
87
72
88
{{< note >}}
73
-
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).
89
+
If you have a Kubernetes cluster running on Google Kubernetes Engine, please
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`.
80
96
81
-
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.
97
+
A [Secret](/docs/concepts/configuration/secret/) is an object that stores a piece
98
+
of sensitive data like a password or key. Since 1.14, `kubectl` supports the
99
+
management of Kubernetes objects using a kustomization file. You can create a Secret
100
+
by generators in `kustomization.yaml`.
101
+
102
+
Add a Secret generator in `kustomization.yaml` from the following command.
103
+
You will need to replace `YOUR_PASSWORD` with the password you want to use.
82
104
83
105
```shell
84
106
cat <<EOF >./kustomization.yaml
@@ -91,42 +113,46 @@ EOF
91
113
92
114
## Add resource configs for MySQL and WordPress
93
115
94
-
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.
116
+
The following manifest describes a single-instance MySQL Deployment. The MySQL
117
+
container mounts the PersistentVolume at /var/lib/mysql. The `MYSQL_ROOT_PASSWORD`
118
+
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.
221
-
{{< /warning >}}
222
-
223
-
245
+
{{< warning >}}
246
+
Do not leave your WordPress installation on this page. If another user finds it,
247
+
they can set up a website on your instance and use it to serve malicious content.<br/><br/>
248
+
Either install WordPress by creating a username and password or delete your instance.
249
+
{{< /warning >}}
224
250
225
251
## {{% heading "cleanup" %}}
226
252
227
-
228
253
1. Run the following command to delete your Secret, Deployments, Services and PersistentVolumeClaims:
229
254
230
-
```shell
231
-
kubectl delete -k ./
232
-
```
233
-
234
-
255
+
```shell
256
+
kubectl delete -k ./
257
+
```
235
258
236
259
## {{% heading "whatsnext" %}}
237
260
238
-
239
261
* Learn more about [Introspection and Debugging](/docs/tasks/debug/debug-application/debug-running-pod/)
240
262
* Learn more about [Jobs](/docs/concepts/workloads/controllers/job/)
241
263
* Learn more about [Port Forwarding](/docs/tasks/access-application-cluster/port-forward-access-application-cluster/)
242
264
* Learn how to [Get a Shell to a Container](/docs/tasks/debug/debug-application/get-shell-running-container/)
0 commit comments