mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 12:32:03 +00:00
update examples/mysql-wordpress-pd to v1
This commit is contained in:
parent
bdeb4f31a8
commit
780e51eac3
@ -66,7 +66,7 @@ First, **edit [`mysql.yaml`](mysql.yaml)**, the mysql pod definition, to use a d
|
|||||||
`mysql.yaml` looks like this:
|
`mysql.yaml` looks like this:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: mysql
|
name: mysql
|
||||||
@ -135,7 +135,7 @@ So if we label our Kubernetes mysql service `mysql`, the wordpress pod will be a
|
|||||||
The [`mysql-service.yaml`](mysql-service.yaml) file looks like this:
|
The [`mysql-service.yaml`](mysql-service.yaml) file looks like this:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
@ -170,7 +170,7 @@ Once the mysql service is up, start the wordpress pod, specified in
|
|||||||
Note that this config file also defines a volume, this one using the `wordpress-disk` persistent disk that you created.
|
Note that this config file also defines a volume, this one using the `wordpress-disk` persistent disk that you created.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: wordpress
|
name: wordpress
|
||||||
@ -220,23 +220,23 @@ Once the wordpress pod is running, start its service, specified by [`wordpress-s
|
|||||||
The service config file looks like this:
|
The service config file looks like this:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
name: wpfrontend
|
name: wpfrontend
|
||||||
name: wpfrontend
|
name: wpfrontend
|
||||||
spec:
|
spec:
|
||||||
createExternalLoadBalancer: true
|
|
||||||
ports:
|
ports:
|
||||||
# the port that this service should serve on
|
# the port that this service should serve on
|
||||||
- port: 80
|
- port: 80
|
||||||
# label keys and values that must match in order to receive traffic for this service
|
# label keys and values that must match in order to receive traffic for this service
|
||||||
selector:
|
selector:
|
||||||
name: wordpress
|
name: wordpress
|
||||||
|
type: LoadBalancer
|
||||||
```
|
```
|
||||||
|
|
||||||
Note the `createExternalLoadBalancer` setting. This will set up the wordpress service behind an external IP.
|
Note the `type: LoadBalancer` setting. This will set up the wordpress service behind an external IP.
|
||||||
Note also that we've set the service port to 80. We'll return to that shortly.
|
Note also that we've set the service port to 80. We'll return to that shortly.
|
||||||
|
|
||||||
Start the service:
|
Start the service:
|
||||||
@ -251,8 +251,12 @@ and see it in the list of services:
|
|||||||
$ kubectl get services
|
$ kubectl get services
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, find the external IP for your WordPress service by listing the forwarding rules for your project:
|
Then, find the external IP for your WordPress service by running:
|
||||||
|
```
|
||||||
|
$ kubectl get services/wpfrontend --template="{{range .status.loadBalancer.ingress}} {{.ip}} {{end}}"
|
||||||
|
```
|
||||||
|
|
||||||
|
or by listing the forwarding rules for your project:
|
||||||
```shell
|
```shell
|
||||||
$ gcloud compute forwarding-rules list
|
$ gcloud compute forwarding-rules list
|
||||||
```
|
```
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: mysql
|
name: mysql
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
name: wpfrontend
|
name: wpfrontend
|
||||||
name: wpfrontend
|
name: wpfrontend
|
||||||
spec:
|
spec:
|
||||||
createExternalLoadBalancer: true
|
|
||||||
ports:
|
ports:
|
||||||
# the port that this service should serve on
|
# the port that this service should serve on
|
||||||
- port: 80
|
- port: 80
|
||||||
# label keys and values that must match in order to receive traffic for this service
|
# label keys and values that must match in order to receive traffic for this service
|
||||||
selector:
|
selector:
|
||||||
name: wordpress
|
name: wordpress
|
||||||
|
type: LoadBalancer
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
apiVersion: v1beta3
|
apiVersion: v1
|
||||||
kind: Pod
|
kind: Pod
|
||||||
metadata:
|
metadata:
|
||||||
name: wordpress
|
name: wordpress
|
||||||
|
Loading…
Reference in New Issue
Block a user