fix some unsatisfied. (#8746)
* fix some unsatisfied. * fix * add mysql-pv.yaml for run-single-instance-stateful-application * fix some errors.
This commit is contained in:
parent
25d566650b
commit
7569e58485
|
|
@ -9,17 +9,6 @@ spec:
|
||||||
app: mysql
|
app: mysql
|
||||||
clusterIP: None
|
clusterIP: None
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
|
||||||
kind: PersistentVolumeClaim
|
|
||||||
metadata:
|
|
||||||
name: mysql-pv-claim
|
|
||||||
spec:
|
|
||||||
accessModes:
|
|
||||||
- ReadWriteOnce
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
storage: 20Gi
|
|
||||||
---
|
|
||||||
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
|
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
kind: PersistentVolume
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: mysql-pv-volume
|
||||||
|
labels:
|
||||||
|
type: local
|
||||||
|
spec:
|
||||||
|
storageClassName: manual
|
||||||
|
capacity:
|
||||||
|
storage: 20Gi
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
hostPath:
|
||||||
|
path: "/mnt/data"
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: mysql-pv-claim
|
||||||
|
spec:
|
||||||
|
storageClassName: manual
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteOnce
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 20Gi
|
||||||
|
|
@ -49,14 +49,19 @@ Note: The password is defined in the config yaml, and this is insecure. See
|
||||||
for a secure solution.
|
for a secure solution.
|
||||||
|
|
||||||
{{< code file="mysql-deployment.yaml" >}}
|
{{< code file="mysql-deployment.yaml" >}}
|
||||||
|
{{< code file="mysql-pv.yaml" >}}
|
||||||
|
|
||||||
|
1. Deploy the PV and PVC of the YAML file:
|
||||||
|
|
||||||
|
kubectl create -f https://k8s.io/docs/tasks/run-application/mysql-pv.yaml
|
||||||
|
|
||||||
1. Deploy the contents of the YAML file:
|
1. Deploy the contents of the YAML file:
|
||||||
|
|
||||||
kubectl create -f https://k8s.io/docs/tasks/run-application/mysql-deployment.yaml
|
kubectl create -f https://k8s.io/docs/tasks/run-application/mysql-deployment.yaml
|
||||||
|
|
||||||
1. Display information about the Deployment:
|
1. Display information about the Deployment:
|
||||||
|
|
||||||
kubectl describe deployment mysql
|
kubectl describe deployment mysql
|
||||||
|
|
||||||
Name: mysql
|
Name: mysql
|
||||||
Namespace: default
|
Namespace: default
|
||||||
|
|
@ -96,14 +101,14 @@ for a secure solution.
|
||||||
|
|
||||||
1. List the pods created by the Deployment:
|
1. List the pods created by the Deployment:
|
||||||
|
|
||||||
kubectl get pods -l app=mysql
|
kubectl get pods -l app=mysql
|
||||||
|
|
||||||
NAME READY STATUS RESTARTS AGE
|
NAME READY STATUS RESTARTS AGE
|
||||||
mysql-63082529-2z3ki 1/1 Running 0 3m
|
mysql-63082529-2z3ki 1/1 Running 0 3m
|
||||||
|
|
||||||
1. Inspect the PersistentVolumeClaim:
|
1. Inspect the PersistentVolumeClaim:
|
||||||
|
|
||||||
kubectl describe pvc mysql-pv-claim
|
kubectl describe pvc mysql-pv-claim
|
||||||
|
|
||||||
Name: mysql-pv-claim
|
Name: mysql-pv-claim
|
||||||
Namespace: default
|
Namespace: default
|
||||||
|
|
@ -165,6 +170,7 @@ Delete the deployed objects by name:
|
||||||
```
|
```
|
||||||
kubectl delete deployment,svc mysql
|
kubectl delete deployment,svc mysql
|
||||||
kubectl delete pvc mysql-pv-claim
|
kubectl delete pvc mysql-pv-claim
|
||||||
|
kubectl delete pv mysql-pv-volume
|
||||||
```
|
```
|
||||||
|
|
||||||
If you manually provisioned a PersistentVolume, you also need to manually
|
If you manually provisioned a PersistentVolume, you also need to manually
|
||||||
|
|
|
||||||
|
|
@ -474,7 +474,8 @@ func TestExampleObjectSchemas(t *testing.T) {
|
||||||
"deployment-update": {&extensions.Deployment{}},
|
"deployment-update": {&extensions.Deployment{}},
|
||||||
"hpa-php-apache": {&autoscaling.HorizontalPodAutoscaler{}},
|
"hpa-php-apache": {&autoscaling.HorizontalPodAutoscaler{}},
|
||||||
"mysql-configmap": {&api.ConfigMap{}},
|
"mysql-configmap": {&api.ConfigMap{}},
|
||||||
"mysql-deployment": {&api.Service{}, &api.PersistentVolumeClaim{}, &extensions.Deployment{}},
|
"mysql-deployment": {&api.Service{}, &extensions.Deployment{}},
|
||||||
|
"mysql-pv": {&api.PersistentVolume{}, &api.PersistentVolumeClaim{}},
|
||||||
"mysql-services": {&api.Service{}, &api.Service{}},
|
"mysql-services": {&api.Service{}, &api.Service{}},
|
||||||
"mysql-statefulset": {&apps.StatefulSet{}},
|
"mysql-statefulset": {&apps.StatefulSet{}},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue