vsphere pvc (in-tree)
To use Vmware datastores as storage for your Kubernetes/Rancher Cluster you absolutely MUST provision the cluster with a cloud provider. This does not work if you already have the cluster in place, not sure why. Maybe there are other ways but this worked for me :)
Prepare the cloud provider yaml
Replace the IP address of Virtual Center with IP or FQDN
Replace Username and password (duuh)
My datacenter is called āQNetā so replace it this name where appropriate, folder should be where your K8 Nodes reside
cloud_provider:
name: vsphere
vsphereCloudProvider:
disk:
scsicontrollertype: pvscsi
global:
insecure-flag: true
soap-roundtrip-count: 0
virtual_center:
<IP TO vCENTER>:
datacenters: /QNet
port: '443'
soap-roundtrip-count: 0
user: '[email protected]'
password: 'MyPassWord'
workspace:
datacenter: '/QNet'
default-datastore: '/QNet/datastore/datastore_01'
folder: '/QNet/vm/K8'
resourcepool-path: '/QNet/resources'
server: 10.130.140.26
Create a new cluster in Rancher and tick āCustom cloud providerā and the click edit as yaml in the upper right corner
Under ārancher_kubernetes_engine_configā paste the before prepared yaml, like this
Provision the cluster
Once the cluster is done provisioning go to Cluster -> Storage classes and add storage class, switch to Vmware vsphere volume and choose your policies. Save and set as default Storage class. By default if a datastore is not provided it will use the default storage storage class.
Once you have created the storage class you can test it by going to your default project/namespace and click volumes
Add New Volume -> New Volume Claim -> Set amount of storage and then create. You should now see a bound PVC
If you check vSphere storage you should have a folder named kubevols and your vmdk disk
Done
Last updated
Was this helpful?