3 Kubespray can be deployed with vSphere as Cloud provider. This feature supports:
7 - Storage Classes and provisioning of volumes
8 - vSphere Storage Policy Based Management for Containers orchestrated by Kubernetes
10 ## Out-of-tree vSphere cloud provider
14 You need at first to configure your vSphere environment by following the [official documentation](https://github.com/kubernetes/cloud-provider-vsphere/blob/master/docs/book/tutorials/kubernetes-on-vsphere-with-kubeadm.md#prerequisites).
16 After this step you should have:
18 - vSphere upgraded to 6.7 U3 or later
19 - VM hardware upgraded to version 15 or higher
20 - UUID activated for each VM where Kubernetes will be deployed
22 ### Kubespray configuration
24 First in `inventory/sample/group_vars/all.yml` you must set the cloud provider to `external` and external_cloud_provider to `external_cloud_provider`.
27 cloud_provider: "external"
28 external_cloud_provider: "vsphere"
31 Then, `inventory/sample/group_vars/vsphere.yml`, you need to declare your vCenter credentials and enable the vSphere CSI following the description below.
33 | Variable | Required | Type | Choices | Default | Comment |
34 |----------------------------------------|----------|---------|----------------------------|---------------------------|---------------------------------------------------------------------------------------------------------------------|
35 | external_vsphere_vcenter_ip | TRUE | string | | | IP/URL of the vCenter |
36 | external_vsphere_vcenter_port | TRUE | string | | "443" | Port of the vCenter API |
37 | external_vsphere_insecure | TRUE | string | "true", "false" | "true" | set to "true" if the host above uses a self-signed cert |
38 | external_vsphere_user | TRUE | string | | | User name for vCenter with required privileges (Can also be specified with the `VSPHERE_USER` environment variable) |
39 | external_vsphere_password | TRUE | string | | | Password for vCenter (Can also be specified with the `VSPHERE_PASSWORD` environment variable) |
40 | external_vsphere_datacenter | TRUE | string | | | Datacenter name to use |
41 | external_vsphere_kubernetes_cluster_id | TRUE | string | | "kubernetes-cluster-id" | Kubernetes cluster ID to use |
42 | vsphere_csi_enabled | TRUE | boolean | | false | Enable vSphere CSI |
44 Example configuration:
47 external_vsphere_vcenter_ip: "myvcenter.domain.com"
48 external_vsphere_vcenter_port: "443"
49 external_vsphere_insecure: "true"
50 external_vsphere_user: "administrator@vsphere.local"
51 external_vsphere_password: "K8s_admin"
52 external_vsphere_datacenter: "DATACENTER_name"
53 external_vsphere_kubernetes_cluster_id: "kubernetes-cluster-id"
54 vsphere_csi_enabled: true
57 For a more fine-grained CSI setup, refer to the [vsphere-csi](/docs/vsphere-csi.md) documentation.
61 Once the configuration is set, you can execute the playbook again to apply the new configuration:
65 ansible-playbook -i inventory/sample/hosts.ini -b -v cluster.yml
68 You'll find some useful examples [here](https://github.com/kubernetes/cloud-provider-vsphere/blob/master/docs/book/tutorials/kubernetes-on-vsphere-with-kubeadm.md#sample-manifests-to-test-csi-driver-functionality) to test your configuration.
70 ## In-tree vSphere cloud provider ([deprecated](https://cloud-provider-vsphere.sigs.k8s.io/concepts/in_tree_vs_out_of_tree.html))
72 ### Prerequisites (deprecated)
74 You need at first to configure your vSphere environment by following the [official documentation](https://kubernetes.io/docs/getting-started-guides/vsphere/#vsphere-cloud-provider).
76 After this step you should have:
78 - UUID activated for each VM where Kubernetes will be deployed
79 - A vSphere account with required privileges
81 If you intend to leverage the [zone and region node labeling](https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/#failure-domain-beta-kubernetes-io-region), create a tag category for both the zone and region in vCenter. The tags can then be applied at the host, cluster, datacenter, or folder level, and the cloud provider will walk the hierarchy to extract and apply the labels to the Kubernetes nodes.
83 ### Kubespray configuration (deprecated)
85 First you must define the cloud provider in `inventory/sample/group_vars/all.yml` and set it to `vsphere`.
88 cloud_provider: vsphere
91 Then, in the same file, you need to declare your vCenter credentials following the description below.
93 | Variable | Required | Type | Choices | Default | Comment |
94 |------------------------------|----------|---------|----------------------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
95 | vsphere_vcenter_ip | TRUE | string | | | IP/URL of the vCenter |
96 | vsphere_vcenter_port | TRUE | integer | | | Port of the vCenter API. Commonly 443 |
97 | vsphere_insecure | TRUE | integer | 1, 0 | | set to 1 if the host above uses a self-signed cert |
98 | vsphere_user | TRUE | string | | | User name for vCenter with required privileges |
99 | vsphere_password | TRUE | string | | | Password for vCenter |
100 | vsphere_datacenter | TRUE | string | | | Datacenter name to use |
101 | vsphere_datastore | TRUE | string | | | Datastore name to use |
102 | vsphere_working_dir | TRUE | string | | | Working directory from the view "VMs and template" in the vCenter where VM are placed |
103 | vsphere_scsi_controller_type | TRUE | string | buslogic, pvscsi, parallel | pvscsi | SCSI controller name. Commonly "pvscsi". |
104 | vsphere_vm_uuid | FALSE | string | | | VM Instance UUID of virtual machine that host K8s master. Can be retrieved from instanceUuid property in VmConfigInfo, or as vc.uuid in VMX file or in `/sys/class/dmi/id/product_serial` (Optional, only used for Kubernetes <= 1.9.2) |
105 | vsphere_public_network | FALSE | string | | Blank | Name of the network the VMs are joined to |
106 | vsphere_resource_pool | FALSE | string | | Blank | Name of the Resource pool where the VMs are located (Optional, only used for Kubernetes >= 1.9.2) |
107 | vsphere_zone_category | FALSE | string | | | Name of the tag category used to set the `failure-domain.beta.kubernetes.io/zone` label on nodes (Optional, only used for Kubernetes >= 1.12.0) |
108 | vsphere_region_category | FALSE | string | | | Name of the tag category used to set the `failure-domain.beta.kubernetes.io/region` label on nodes (Optional, only used for Kubernetes >= 1.12.0) |
110 Example configuration:
113 vsphere_vcenter_ip: "myvcenter.domain.com"
114 vsphere_vcenter_port: 443
116 vsphere_user: "k8s@vsphere.local"
117 vsphere_password: "K8s_admin"
118 vsphere_datacenter: "DATACENTER_name"
119 vsphere_datastore: "DATASTORE_name"
120 vsphere_working_dir: "Docker_hosts"
121 vsphere_scsi_controller_type: "pvscsi"
122 vsphere_resource_pool: "K8s-Pool"
125 ### Deployment (deprecated)
127 Once the configuration is set, you can execute the playbook again to apply the new configuration:
131 ansible-playbook -i inventory/sample/hosts.ini -b -v cluster.yml
134 You'll find some useful examples [here](https://github.com/kubernetes/examples/tree/master/staging/volumes/vsphere) to test your configuration.