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:
Chen Hong 2018-06-05 05:24:54 +08:00 committed by k8s-ci-robot
parent 25d566650b
commit 7569e58485
4 changed files with 38 additions and 16 deletions

View File

@ -9,17 +9,6 @@ spec:
app: mysql
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
kind: Deployment
metadata:

View File

@ -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

View File

@ -49,14 +49,19 @@ Note: The password is defined in the config yaml, and this is insecure. See
for a secure solution.
{{< 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:
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:
kubectl describe deployment mysql
kubectl describe deployment mysql
Name: mysql
Namespace: default
@ -96,14 +101,14 @@ for a secure solution.
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
mysql-63082529-2z3ki 1/1 Running 0 3m
1. Inspect the PersistentVolumeClaim:
kubectl describe pvc mysql-pv-claim
kubectl describe pvc mysql-pv-claim
Name: mysql-pv-claim
Namespace: default
@ -165,6 +170,7 @@ Delete the deployed objects by name:
```
kubectl delete deployment,svc mysql
kubectl delete pvc mysql-pv-claim
kubectl delete pv mysql-pv-volume
```
If you manually provisioned a PersistentVolume, you also need to manually

View File

@ -474,7 +474,8 @@ func TestExampleObjectSchemas(t *testing.T) {
"deployment-update": {&extensions.Deployment{}},
"hpa-php-apache": {&autoscaling.HorizontalPodAutoscaler{}},
"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-statefulset": {&apps.StatefulSet{}},
},