text stringlengths 0 59.1k |
|---|
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: registry.k8s.io/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 |
``` |
In the above example datastore1 is located in the root folder. If datastore is member of Datastore Cluster or located in sub folder, the folder path needs to be provided in the VolumePath as below. |
```yaml |
vsphereVolume: |
VolumePath: "[DatastoreCluster/datastore1] volumes/myDisk" |
``` |
[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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.