forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubernetes#6002 from markturansky/yoko_pv_client
PersistentVolume & PersistentVolumeClaim Client
- Loading branch information
Showing
39 changed files
with
2,191 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1beta3 | ||
metadata: | ||
name: myclaim-1 | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1beta3 | ||
metadata: | ||
name: myclaim-2 | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"kind": "PersistentVolumeClaim", | ||
"apiVersion": "v1beta3", | ||
"metadata": { | ||
"name": "myclaim-3" | ||
}, "spec": { | ||
"accessModes": [ | ||
"ReadWriteOnce", | ||
"ReadOnlyMany" | ||
], | ||
"resources": { | ||
"requests": { | ||
"storage": "10G" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# How To Use Persistent Volumes | ||
|
||
This guide assumes knowledge of Kubernetes fundamentals and that a user has a cluster up and running. | ||
|
||
## Create volumes | ||
|
||
Persistent Volumes are intended for "network volumes", such as GCE Persistent Disks, NFS shares, and AWS EBS volumes. | ||
|
||
The `HostPath` VolumeSource was included in the Persistent Volumes implementation for ease of testing. | ||
|
||
Create persistent volumes by posting them to the API server: | ||
|
||
``` | ||
cluster/kubectl.sh create -f examples/persistent-volumes/volumes/local-01.yaml | ||
cluster/kubectl.sh create -f examples/persistent-volumes/volumes/local-02.yaml | ||
cluster/kubectl.sh get pv | ||
NAME LABELS CAPACITY ACCESSMODES STATUS CLAIM | ||
pv0001 map[] 10737418240 RWO | ||
pv0002 map[] 5368709120 RWO | ||
In the log: | ||
I0302 10:20:45.663225 1920 persistent_volume_manager.go:115] Managing PersistentVolume[UID=b16e91d6-c0ef-11e4-8be4-80e6500a981e] | ||
I0302 10:20:55.667945 1920 persistent_volume_manager.go:115] Managing PersistentVolume[UID=b41f4f0e-c0ef-11e4-8be4-80e6500a981e] | ||
``` | ||
|
||
## Create claims | ||
|
||
You must be in a namespace to create claims. | ||
|
||
``` | ||
cluster/kubectl.sh create -f examples/persistent-volumes/claims/claim-01.yaml | ||
cluster/kubectl.sh create -f examples/persistent-volumes/claims/claim-02.yaml | ||
NAME LABELS STATUS VOLUME | ||
myclaim-1 map[] | ||
myclaim-2 map[] | ||
``` | ||
|
||
|
||
## Matching and binding | ||
|
||
``` | ||
PersistentVolumeClaim[UID=f4b3d283-c0ef-11e4-8be4-80e6500a981e] bound to PersistentVolume[UID=b16e91d6-c0ef-11e4-8be4-80e6500a981e] | ||
cluster/kubectl.sh get pv | ||
NAME LABELS CAPACITY ACCESSMODES STATUS CLAIM | ||
pv0001 map[] 10737418240 RWO myclaim-1 / f4b3d283-c0ef-11e4-8be4-80e6500a981e | ||
pv0002 map[] 5368709120 RWO myclaim-2 / f70da891-c0ef-11e4-8be4-80e6500a981e | ||
cluster/kubectl.sh get pvc | ||
NAME LABELS STATUS VOLUME | ||
myclaim-1 map[] b16e91d6-c0ef-11e4-8be4-80e6500a981e | ||
myclaim-2 map[] b41f4f0e-c0ef-11e4-8be4-80e6500a981e | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"kind": "Namespace", | ||
"apiVersion":"v1beta3", | ||
"metadata": { | ||
"name": "myns", | ||
"labels": { | ||
"name": "development" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
kind: Pod | ||
apiVersion: v1beta3 | ||
metadata: | ||
name: mypod | ||
spec: | ||
containers: | ||
- image: dockerfile/nginx | ||
name: myfrontend | ||
volumeMounts: | ||
- mountPath: "/var/www/html" | ||
name: mypd | ||
volumes: | ||
- name: mypd | ||
source: | ||
persistentVolumeClaim: | ||
accessMode: ReadWriteOnce | ||
claimRef: | ||
name: myclaim-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
kind: PersistentVolume | ||
apiVersion: v1beta3 | ||
metadata: | ||
name: pv0003 | ||
spec: | ||
capacity: | ||
storage: 10 | ||
gcePersistentDisk: | ||
pdName: "abc123" | ||
fsType: "ext4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
kind: PersistentVolume | ||
apiVersion: v1beta3 | ||
metadata: | ||
name: pv0001 | ||
labels: | ||
type: local | ||
spec: | ||
capacity: | ||
storage: 10Gi | ||
hostPath: | ||
path: "/tmp/data01" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
kind: PersistentVolume | ||
apiVersion: v1beta3 | ||
metadata: | ||
name: pv0002 | ||
labels: | ||
type: local | ||
spec: | ||
capacity: | ||
storage: 5Gi | ||
hostPath: | ||
path: "/tmp/data02" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.