Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
54cf6b06
Commit
54cf6b06
authored
Oct 17, 2016
by
Abrar Shivani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add vSphere Volume Examples
parent
19e9f7e4
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
491 additions
and
1 deletion
+491
-1
README.md
...les/experimental/persistent-volume-provisioning/README.md
+1
-1
README.md
examples/volumes/vsphere/README.md
+372
-0
deployment.yaml
examples/volumes/vsphere/deployment.yaml
+23
-0
vsphere-volume-pod.yaml
examples/volumes/vsphere/vsphere-volume-pod.yaml
+18
-0
vsphere-volume-pv.yaml
examples/volumes/vsphere/vsphere-volume-pv.yaml
+14
-0
vsphere-volume-pvc.yaml
examples/volumes/vsphere/vsphere-volume-pvc.yaml
+11
-0
vsphere-volume-pvcpod.yaml
examples/volumes/vsphere/vsphere-volume-pvcpod.yaml
+16
-0
vsphere-volume-pvcsc.yaml
examples/volumes/vsphere/vsphere-volume-pvcsc.yaml
+12
-0
vsphere-volume-pvcscpod.yaml
examples/volumes/vsphere/vsphere-volume-pvcscpod.yaml
+16
-0
vsphere-volume-sc-fast.yaml
examples/volumes/vsphere/vsphere-volume-sc-fast.yaml
+8
-0
No files found.
examples/experimental/persistent-volume-provisioning/README.md
View file @
54cf6b06
...
...
@@ -92,7 +92,7 @@ metadata:
name
:
slow
provisioner
:
kubernetes.io/vsphere-volume
parameters
:
diskformat
:
thin
diskformat
:
eagerzeroedthick
```
*
`diskformat`
:
`thin`
,
`zeroedthick`
and
`eagerzeroedthick`
. See vSphere docs for details. Default:
`"thin"`
.
...
...
examples/volumes/vsphere/README.md
0 → 100644
View file @
54cf6b06
<!-- BEGIN MUNGE: UNVERSIONED_WARNING -->
<!-- BEGIN STRIP_FOR_RELEASE -->
<img src="http://kubernetes.io/kubernetes/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/kubernetes/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/kubernetes/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/kubernetes/img/warning.png" alt="WARNING"
width="25" height="25">
<img src="http://kubernetes.io/kubernetes/img/warning.png" alt="WARNING"
width="25" height="25">
<h2>
PLEASE NOTE: This document applies to the HEAD of the source tree
</h2>
If you are using a released version of Kubernetes, you should
refer to the docs that go with that version.
Documentation for other releases can be found at
[
releases.k8s.io
](
http://releases.k8s.io
)
.
</strong>
--
<!-- END STRIP_FOR_RELEASE -->
<!-- END MUNGE: UNVERSIONED_WARNING -->
# vSphere Volume
-
[
Prerequisites
](
#prerequisites
)
-
[
Examples
](
#examples
)
-
[
Volumes
](
#volumes
)
-
[
Persistent Volumes
](
#persistent-volumes
)
-
[
Storage Class
](
#storage-class
)
## Prerequisites
-
Kubernetes with vSphere Cloud Provider configured.
For cloudprovider configuration please refer
[
vSphere getting started guide
](
http://kubernetes.io/docs/getting-started-guides/vsphere/
)
.
## Examples
### Volumes
1.
Create VMDK.
First ssh into ESX and then use following command to create vmdk,
```shell
vmkfstools -c 2G /vmfs/volumes/datastore1/volumes/myDisk.vmdk
```
2.
Create Pod which uses 'myDisk.vmdk'.
See example
```yaml
apiVersion: v1
kind: Pod
metadata:
name: test-vmdk
spec:
containers:
- image: gcr.io/google_containers/test-webserver
name: test-container
volumeMounts:
- mountPath: /test-vmdk
name: test-volume
volumes:
- name: test-volume
# This VMDK volume must already exist.
vsphereVolume:
volumePath: "[datastore1] volumes/myDisk"
fsType: ext4
```
[Download example](vsphere-volume-pod.yaml?raw=true)
Creating the pod:
``` bash
$ kubectl create -f examples/volumes/vsphere/vsphere-volume-pod.yaml
```
Verify that pod is running:
```bash
$ kubectl get pods test-vmdk
NAME READY STATUS RESTARTS AGE
test-vmdk 1/1 Running 0 48m
```
### Persistent Volumes
1.
Create VMDK.
First ssh into ESX and then use following command to create vmdk,
```shell
vmkfstools -c 2G /vmfs/volumes/datastore1/volumes/myDisk.vmdk
```
2.
Create Persistent Volume.
See example:
```yaml
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv0001
spec:
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
vsphereVolume:
volumePath: "[datastore1] volumes/myDisk"
fsType: ext4
```
[Download example](vsphere-volume-pv.yaml?raw=true)
Creating the persistent volume:
``` bash
$ kubectl create -f examples/volumes/vsphere/vsphere-volume-pv.yaml
```
Verifying persistent volume is created:
``` bash
$ kubectl describe pv pv0001
Name: pv0001
Labels: <none>
Status: Available
Claim:
Reclaim Policy: Retain
Access Modes: RWO
Capacity: 2Gi
Message:
Source:
Type: vSphereVolume (a Persistent Disk resource in vSphere)
VolumePath: [datastore1] volumes/myDisk
FSType: ext4
No events.
```
3.
Create Persistent Volume Claim.
See example:
```yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvc0001
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
```
[Download example](vsphere-volume-pvc.yaml?raw=true)
Creating the persistent volume claim:
``` bash
$ kubectl create -f examples/volumes/vsphere/vsphere-volume-pvc.yaml
```
Verifying persistent volume claim is created:
``` bash
$ kubectl describe pvc pvc0001
Name: pvc0001
Namespace: default
Status: Bound
Volume: pv0001
Labels: <none>
Capacity: 2Gi
Access Modes: RWO
No events.
```
3.
Create Pod which uses Persistent Volume Claim.
See example:
```yaml
apiVersion: v1
kind: Pod
metadata:
name: pvpod
spec:
containers:
- name: test-container
image: gcr.io/google_containers/test-webserver
volumeMounts:
- name: test-volume
mountPath: /test-vmdk
volumes:
- name: vmdk-storage
persistentVolumeClaim:
claimName: pvc0001
```
[Download example](vsphere-volume-pvcpod.yaml?raw=true)
Creating the pod:
``` bash
$ kubectl create -f examples/volumes/vsphere/vsphere-volume-pvcpod.yaml
```
Verifying pod is created:
``` bash
$ kubectl get pod pvpod
NAME READY STATUS RESTARTS AGE
pvpod 1/1 Running 0 48m
```
### Storage Class
__Note: Here you don't need to create vmdk it is created for you.__
1.
Create Storage Class.
See example:
```yaml
kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: fast
provisioner: kubernetes.io/vsphere-volume
parameters:
diskformat: zeroedthick
```
[Download example](vsphere-volume-sc-fast.yaml?raw=true)
Creating the storageclass:
``` bash
$ kubectl create -f examples/volumes/vsphere/vsphere-volume-sc-fast.yaml
```
Verifying storage class is created:
``` bash
$ kubectl describe storageclass fast
Name: fast
Annotations: <none>
Provisioner: kubernetes.io/vsphere-volume
Parameters: diskformat=zeroedthick
No events.
```
2.
Create Persistent Volume Claim.
See example:
```yaml
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: pvcsc001
annotations:
volume.beta.kubernetes.io/storage-class: fast
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
```
[Download example](vsphere-volume-pvcsc.yaml?raw=true)
Creating the persistent volume claim:
``` bash
$ kubectl create -f examples/volumes/vsphere/vsphere-volume-pvcsc.yaml
```
Verifying persistent volume claim is created:
``` bash
$ kubectl describe pvc pvcsc001
Name: pvcsc001
Namespace: default
Status: Bound
Volume: pvc-80f7b5c1-94b6-11e6-a24f-005056a79d2d
Labels: <none>
Capacity: 2Gi
Access Modes: RWO
No events.
```
Persistent Volume is automatically created and is bounded to this pvc.
Verifying persistent volume claim is created:
``` bash
$ kubectl describe pv pvc-80f7b5c1-94b6-11e6-a24f-005056a79d2d
Name: pvc-80f7b5c1-94b6-11e6-a24f-005056a79d2d
Labels: <none>
Status: Bound
Claim: default/pvcsc001
Reclaim Policy: Delete
Access Modes: RWO
Capacity: 2Gi
Message:
Source:
Type: vSphereVolume (a Persistent Disk resource in vSphere)
VolumePath: [datastore1] kubevols/kubernetes-dynamic-pvc-80f7b5c1-94b6-11e6-a24f-005056a79d2d.vmdk
FSType: ext4
No events.
```
__Note: VMDK is created inside ```kubevols``` folder in datastore which is mentioned in 'vsphere' cloudprovider configuration.
The cloudprovider config is created during setup of Kubernetes cluster on vSphere.__
3.
Create Pod which uses Persistent Volume Claim with storage class.
See example:
```yaml
apiVersion: v1
kind: Pod
metadata:
name: pvpod
spec:
containers:
- name: test-container
image: gcr.io/google_containers/test-webserver
volumeMounts:
- name: test-volume
mountPath: /test-vmdk
volumes:
- name: vmdk-storage
persistentVolumeClaim:
claimName: pvcsc001
```
[Download example](vsphere-volume-pvcscpod.yaml?raw=true)
Creating the pod:
``` bash
$ kubectl create -f examples/volumes/vsphere/vsphere-volume-pvcscpod.yaml
```
Verifying pod is created:
``` bash
$ kubectl get pod pvpod
NAME READY STATUS RESTARTS AGE
pvpod 1/1 Running 0 48m
```
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[

]()
<!-- END MUNGE: GENERATED_ANALYTICS -->
examples/volumes/vsphere/deployment.yaml
0 → 100644
View file @
54cf6b06
apiVersion
:
extensions/v1beta1
kind
:
Deployment
metadata
:
name
:
deployment
spec
:
replicas
:
1
template
:
metadata
:
labels
:
app
:
redis
spec
:
containers
:
-
name
:
redis
image
:
redis
volumeMounts
:
-
name
:
vmfs-vmdk-storage
mountPath
:
/data/
volumes
:
-
name
:
vmfs-vmdk-storage
vsphereVolume
:
volumePath
:
"
[Datastore]
volumes/testdir"
fsType
:
ext4
\ No newline at end of file
examples/volumes/vsphere/vsphere-volume-pod.yaml
0 → 100644
View file @
54cf6b06
apiVersion
:
v1
kind
:
Pod
metadata
:
name
:
test-vmdk
spec
:
containers
:
-
image
:
gcr.io/google_containers/test-webserver
name
:
test-container
volumeMounts
:
-
mountPath
:
/test-vmdk
name
:
test-volume
volumes
:
-
name
:
test-volume
# This VMDK volume must already exist.
vsphereVolume
:
volumePath
:
"
[DatastoreName]
volumes/myDisk"
fsType
:
ext4
\ No newline at end of file
examples/volumes/vsphere/vsphere-volume-pv.yaml
0 → 100644
View file @
54cf6b06
apiVersion
:
v1
kind
:
PersistentVolume
metadata
:
name
:
pv0001
spec
:
capacity
:
storage
:
2Gi
accessModes
:
-
ReadWriteOnce
persistentVolumeReclaimPolicy
:
Retain
vsphereVolume
:
volumePath
:
"
[DatastoreName]
volumes/myDisk"
fsType
:
ext4
\ No newline at end of file
examples/volumes/vsphere/vsphere-volume-pvc.yaml
0 → 100644
View file @
54cf6b06
kind
:
PersistentVolumeClaim
apiVersion
:
v1
metadata
:
name
:
pvc0001
spec
:
accessModes
:
-
ReadWriteOnce
resources
:
requests
:
storage
:
2Gi
\ No newline at end of file
examples/volumes/vsphere/vsphere-volume-pvcpod.yaml
0 → 100644
View file @
54cf6b06
apiVersion
:
v1
kind
:
Pod
metadata
:
name
:
pvpod
spec
:
containers
:
-
name
:
test-container
image
:
gcr.io/google_containers/test-webserver
volumeMounts
:
-
name
:
test-volume
mountPath
:
/test-vmdk
volumes
:
-
name
:
vmdk-storage
persistentVolumeClaim
:
claimName
:
pvc0001
\ No newline at end of file
examples/volumes/vsphere/vsphere-volume-pvcsc.yaml
0 → 100644
View file @
54cf6b06
kind
:
PersistentVolumeClaim
apiVersion
:
v1
metadata
:
name
:
pvcsc001
annotations
:
volume.beta.kubernetes.io/storage-class
:
fast
spec
:
accessModes
:
-
ReadWriteOnce
resources
:
requests
:
storage
:
2Gi
examples/volumes/vsphere/vsphere-volume-pvcscpod.yaml
0 → 100644
View file @
54cf6b06
apiVersion
:
v1
kind
:
Pod
metadata
:
name
:
pvpod
spec
:
containers
:
-
name
:
test-container
image
:
gcr.io/google_containers/test-webserver
volumeMounts
:
-
name
:
test-volume
mountPath
:
/test-vmdk
volumes
:
-
name
:
vmdk-storage
persistentVolumeClaim
:
claimName
:
pvcsc0001
\ No newline at end of file
examples/volumes/vsphere/vsphere-volume-sc-fast.yaml
0 → 100644
View file @
54cf6b06
kind
:
StorageClass
apiVersion
:
storage.k8s.io/v1beta1
metadata
:
name
:
fast
provisioner
:
kubernetes.io/vsphere-volume
parameters
:
diskformat
:
zeroedthick
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment