This document shows how to configure a VM storage policy for a Google Distributed Cloud cluster.
When you use a VM storage policy, storage for the cluster nodes is distributed among multiple datastores in your vSphere environment. This capability is based on Storage Policy Based Management, which enables you to define storage policies based on your application requirements and cluster configuration.[
Apply tags to datastores
Your vSphere environment must have at least two datastores that you can use for this exercise.
The vSphere cluster that hosts the nodes for your user cluster must have access to the two datastores that you use for this exercise and to the datastore used by the admin cluster.
The vCenter account that you use to apply tags must have the following vSphere tagging privileges privileges on the root vCenter Server:
- vSphere Tagging.Create vSphere Tag
- vSphere Tagging.Create vSphere Tag Category
- vSphere Tagging.Assign or Unassign vSphere Tag
In the vSphere Client, assign the same tag to each of the datastores that you have chosen to use for this exercise. For instructions, see Assign Tags to Datastores.
For additional information, see vSphere Tags and Attributes.
Create a storage policy
In the vSphere Client, create a VM storage policy for tag-based placement. In the storage policy, specify the tag that you applied to your chosen datastores. For instructions, see Create a VM storage policy for Tag-Based Placement.
For additional information, see VM storage policy.
If you are using a vSAN datastore, see vSAN storage policy.
Create a user cluster
This section gives an example of how to create a user cluster that uses a storage policy. The cluster has a high-availability control plane, so there are three control-plane nodes. In addition to the control-plane nodes, there are six worker nodes, three in one node pool and three in a second node pool. All nodes use static IP addresses.
Start by following the instructions in Create a user cluster (ControlPlane V2).
As you fill in your user cluster configuration file:
Set the value of
vCenter.storagePolicyName
to the name of an existing storage policy. Do not set a value forvCenter.datastore
.Specify two node pools. For the first node pool, do not specify a datastore, and do not specify a storage policy. For the second node pool, set the value of
vsphere.datastore
to the name of an existing datastore.
Example cluster configuration file
Here is an example of an IP block file and a portion of a user cluster configuration file.
user-ipblock.yaml
blocks: - netmask: 255.255.255.0 gateway: 172.16.21.1 ips: - ip: 172.16.21.2 - ip: 172.16.21.3 - ip: 172.16.21.4 - ip: 172.16.21.5 - ip: 172.16.21.6 - ip: 172.16.21.7 - ip: 172.16.21.8
user-cluster-yaml
apiVersion: v1 kind: UserCluster ... vCenter: storagePolicyName: "my-storage-policy" network: hostConfig: dnsServers: - "203.0.113.2" - "198.51.100.2" ntpServers: - "216.239.35.4" ipMode: type: "static" ipBlockFilePath: "user-ipblock.yaml" controlPlaneIPBlock: netmask: "255.255.255.0" gateway: "172.16.21.1" ips: - ip: "172.16.21.9" hostname: "cp-vm-1" - ip: "172.16.21.10" hostname: "cp-vm-2" - ip: "172.16.21.11" hostname: "cp-vm-3" loadBalancer: vips: controlPlaneVIP: "172.16.21.40" ingressVIP: "172.16.21.30" kind: MetalLB metalLB: addressPools: - name: "address-pool-1" addresses: - "172.16.21.30-172.16.21.39" ... enableControlplaneV2: true masterNode: cpus: 4 memoryMB: 8192 replicas: 3 nodePools: - name: "worker-pool-1" enableLoadBalancer: true - name: "worker-pool-2" vSphere: datastore: "my-np2-datastore" ...
These are the important points to understand in the preceding example:
The static IP addresses for the worker nodes are specified in an IP block file. The IP block file has seven addresses even though there are only six worker nodes. The extra IP address is needed during cluster upgrade, update, and auto repair.
The static IP addresses for the three control-plane nodes are specified in the
network.controlPlaneIPBlock
section of the user cluster configuration file. There is no need for an extra IP address in this block.The
masterNode.replicas
field is set to3
, so there will be three control-plane nodes. UndermasterNode
, nothing is specified forvsphere.datastore
orvsphere.storagePolicyName
. So the control-plane nodes will use the storage policy specified invCenter.storagePolicyName
.The user cluster configuration file includes a value for
vCenter.storagePolicy
, but it does not include a value forvCenter.datastore
. The specified storage policy will be used by nodes in any pool that does not specify its own storage policy or its own datastore.Under
node-pool-1
, nothing is specified forvsphere.datastore
orvsphere.storagePolicyName
. So the nodes innode-pool-1
will use the storage policy specified invCenter.storagePolicyName
.Under
node-pool-2
, the value ofvsphere.datastore
ismy-np2-datastore
, so the nodes innode-pool-2
will use that one datastore, and will not use a storage policy.
Continue creating your user cluster as described in Create a user cluster (Controlplane V2).