|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * storage/container_storage_interface/persistent-storage-csi-gcp-pd.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="persistent-storage-csi-gcp-hyperdisk-storage-pools-procedure_{context}"] |
| 7 | += Setting up hyperdisk-balanced disks |
| 8 | + |
| 9 | +.Prerequisites |
| 10 | +* Access to the cluster with administrative privileges |
| 11 | +
|
| 12 | +.Procedure |
| 13 | +To set up hyperdisk-balanced disks: |
| 14 | + |
| 15 | +ifndef::openshift-dedicated[] |
| 16 | +. Create GCP cluster with attached disks provisioned with hyperdisk-balanced disks. |
| 17 | +endif::openshift-dedicated[] |
| 18 | + |
| 19 | +ifndef::openshift-dedicated[] |
| 20 | +. Create a storage class specifying the hyperdisk-balanced disks during installation: |
| 21 | +endif::openshift-dedicated[] |
| 22 | + |
| 23 | +ifndef::openshift-dedicated[] |
| 24 | +.. Follow the procedure in the _Installing a cluster on GCP with customizations_ section. |
| 25 | ++ |
| 26 | +For your install-config.yaml file, use the following example file: |
| 27 | ++ |
| 28 | +.Example install-config YAML file |
| 29 | +[source, yaml] |
| 30 | +---- |
| 31 | +apiVersion: v1 |
| 32 | +metadata: |
| 33 | + name: ci-op-9976b7t2-8aa6b |
| 34 | + |
| 35 | +sshKey: | |
| 36 | + XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 37 | +baseDomain: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
| 38 | +platform: |
| 39 | + gcp: |
| 40 | + projectID: XXXXXXXXXXXXXXXXXXXXXX |
| 41 | + region: us-central1 |
| 42 | +controlPlane: |
| 43 | + architecture: amd64 |
| 44 | + name: master |
| 45 | + platform: |
| 46 | + gcp: |
| 47 | + type: n4-standard-4 <1> |
| 48 | + osDisk: |
| 49 | + diskType: hyperdisk-balanced <2> |
| 50 | + diskSizeGB: 200 |
| 51 | + replicas: 3 |
| 52 | +compute: |
| 53 | +- architecture: amd64 |
| 54 | + name: worker |
| 55 | + replicas: 3 |
| 56 | + platform: |
| 57 | + gcp: |
| 58 | + type: n4-standard-4 <1> |
| 59 | + osDisk: |
| 60 | + diskType: hyperdisk-balanced <2> |
| 61 | +---- |
| 62 | +<1> Specifies the node type as n4-standard-4. |
| 63 | +<2> Specifies the node has the root disk backed by hyperdisk-balanced disk type. All nodes in the cluster should use the same disk type, either hyperdisks-balanced or pd-*. |
| 64 | ++ |
| 65 | +[NOTE] |
| 66 | +==== |
| 67 | +All nodes in the cluster must support hyperdisk-balanced volumes. Clusters with mixed nodes are not supported, for example N2 and N3 using hyperdisk-balanced disks. |
| 68 | +==== |
| 69 | +endif::openshift-dedicated[] |
| 70 | +
|
| 71 | +ifndef::openshift-dedicated[] |
| 72 | +.. After step 3 in _Incorporating the Cloud Credential Operator utility manifests_ section, copy the following manifests into the manifests directory created by the installation program: |
| 73 | ++ |
| 74 | +* cluster_csi_driver.yaml - specifies opting out of the default storage class creation |
| 75 | +* storageclass.yaml - creates a hyperdisk-specific storage class |
| 76 | ++ |
| 77 | +.Example cluster CSI driver YAML file |
| 78 | +[source, yaml] |
| 79 | +---- |
| 80 | +apiVersion: operator.openshift.io/v1 |
| 81 | +kind: "ClusterCSIDriver" |
| 82 | +metadata: |
| 83 | + name: "pd.csi.storage.gke.io" |
| 84 | +spec: |
| 85 | + logLevel: Normal |
| 86 | + managementState: Managed |
| 87 | + operatorLogLevel: Normal |
| 88 | + storageClassState: Unmanaged <1> |
| 89 | +---- |
| 90 | +<1> Specifies disabling creation of the default {product-title} storage classes. |
| 91 | ++ |
| 92 | +.Example storage class YAML file |
| 93 | +[source, yaml] |
| 94 | +---- |
| 95 | +apiVersion: storage.k8s.io/v1 |
| 96 | +kind: StorageClass |
| 97 | +metadata: |
| 98 | + name: hyperdisk-sc <1> |
| 99 | + annotations: |
| 100 | + storageclass.kubernetes.io/is-default-class: "true" |
| 101 | +provisioner: pd.csi.storage.gke.io <2> |
| 102 | +volumeBindingMode: WaitForFirstConsumer |
| 103 | +allowVolumeExpansion: true |
| 104 | +reclaimPolicy: Delete |
| 105 | +parameters: |
| 106 | + type: hyperdisk-balanced <3> |
| 107 | + replication-type: none |
| 108 | + provisioned-throughput-on-create: "140Mi" <4> |
| 109 | + provisioned-iops-on-create: "3000" <5> |
| 110 | + storage-pools: projects/my-project/zones/us-east4-c/storagePools/pool-us-east4-c <6> |
| 111 | +allowedTopologies: <7> |
| 112 | +- matchLabelExpressions: |
| 113 | + - key: topology.kubernetes.io/zone |
| 114 | + values: |
| 115 | + - us-east4-c |
| 116 | +... |
| 117 | +---- |
| 118 | +<1> Specify the name for your storage class. In this example, it is `hyperdisk-sc`. |
| 119 | +<2> `pd.csi.storage.gke.io` specifies GCP CSI provisioner. |
| 120 | +<3> Specifies using hyperdisk-balanced disks. |
| 121 | +<4> Specifies the throughput value in MiBps using the "Mi" qualifier. For example, if your required throughput is 250 MiBps, specify "250Mi". If you do not specify a value, the capacity is based upon the disk type default. |
| 122 | +<5> Specifies the IOPS value without any qualifiers. For example, if you require 7,000 IOPS, specify "7000". If you do not specify a value, the capacity is based upon the disk type default. |
| 123 | +<6> If using storage pools, specify a list of specific storage pools that you want to use in the format: projects/PROJECT_ID/zones/ZONE/storagePools/STORAGE_POOL_NAME. |
| 124 | +<7> If using storage pools, set `allowedTopologies` to restrict the topology of provisioned volumes to where the storage pool exists. In this example, `us-east4-c`. |
| 125 | +endif::openshift-dedicated[] |
| 126 | +
|
| 127 | +. Create a persistent volume claim (PVC) that uses the hyperdisk-specific storage class using the following example YAML file: |
| 128 | ++ |
| 129 | +.Example PVC YAML file |
| 130 | +[source, yaml] |
| 131 | +---- |
| 132 | +apiVersion: v1 |
| 133 | +kind: PersistentVolumeClaim |
| 134 | +metadata: |
| 135 | + name: my-pvc |
| 136 | +spec: |
| 137 | + storageClassName: hyperdisk-sc <1> |
| 138 | + accessModes: |
| 139 | + - ReadWriteOnce |
| 140 | + resources: |
| 141 | + requests: |
| 142 | + storage: 2048Gi <2> |
| 143 | +---- |
| 144 | +<1> PVC references the the storage pool-specific storage class. In this example, `hyperdisk-sc`. |
| 145 | +<2> Target storage capacity of the hyperdisk-balanced volume. In this example, `2048Gi`. |
| 146 | +
|
| 147 | +. Create a deployment that uses the PVC that you just created. Using a deployment helps ensure that your application has access to the persistent storage even after the pod restarts and rescheduling: |
| 148 | +
|
| 149 | +.. Ensure a node pool with the specified machine series is up and running before creating the deployment. Otherwise, the pod fails to schedule. |
| 150 | +
|
| 151 | +.. Use the following example YAML file to create the deployment: |
| 152 | ++ |
| 153 | +.Example deployment YAML file |
| 154 | +[source, yaml] |
| 155 | +---- |
| 156 | +apiVersion: apps/v1 |
| 157 | +kind: Deployment |
| 158 | +metadata: |
| 159 | + name: postgres |
| 160 | +spec: |
| 161 | + selector: |
| 162 | + matchLabels: |
| 163 | + app: postgres |
| 164 | + template: |
| 165 | + metadata: |
| 166 | + labels: |
| 167 | + app: postgres |
| 168 | + spec: |
| 169 | + nodeSelector: |
| 170 | + cloud.google.com/machine-family: n4 <1> |
| 171 | + containers: |
| 172 | + - name: postgres |
| 173 | + image: postgres:14-alpine |
| 174 | + args: [ "sleep", "3600" ] |
| 175 | + volumeMounts: |
| 176 | + - name: sdk-volume |
| 177 | + mountPath: /usr/share/data/ |
| 178 | + volumes: |
| 179 | + - name: sdk-volume |
| 180 | + persistentVolumeClaim: |
| 181 | + claimName: my-pvc <2> |
| 182 | +---- |
| 183 | +<1> Specifies the machine family. In this example, it is `n4`. |
| 184 | +<2> Specifies the name of the PVC created in the preceding step. In this example, it is `my-pfc`. |
| 185 | +
|
| 186 | +.. Confirm that the deployment was successfully created by running the following command: |
| 187 | ++ |
| 188 | +[source, terminal] |
| 189 | +---- |
| 190 | +$ oc get deployment |
| 191 | +---- |
| 192 | ++ |
| 193 | +.Example output |
| 194 | +[source, terminal] |
| 195 | +---- |
| 196 | +NAME READY UP-TO-DATE AVAILABLE AGE |
| 197 | +postgres 0/1 1 0 42s |
| 198 | +---- |
| 199 | ++ |
| 200 | +It might take a few minutes for hyperdisk instances to complete provisioning and display a READY status. |
| 201 | +
|
| 202 | +.. Confirm that PVC `my-pvc` has been successfully bound to a persistent volume (PV) by running the following command: |
| 203 | ++ |
| 204 | +[source, terminal] |
| 205 | +---- |
| 206 | +$ oc get pvc my-pvc |
| 207 | +---- |
| 208 | ++ |
| 209 | +.Example output |
| 210 | ++ |
| 211 | +[source, terminal] |
| 212 | +---- |
| 213 | +NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE |
| 214 | +my-pvc Bound pvc-1ff52479-4c81-4481-aa1d-b21c8f8860c6 2Ti RWO hyperdisk-sc <unset> 2m24s |
| 215 | +---- |
| 216 | +
|
| 217 | +.. Confirm the expected configuration of your hyperdisk-balanced disk: |
| 218 | ++ |
| 219 | +[source, terminal] |
| 220 | +---- |
| 221 | +$ gcloud compute disks list |
| 222 | +---- |
| 223 | ++ |
| 224 | +.Example output |
| 225 | ++ |
| 226 | +[source, terminal] |
| 227 | +---- |
| 228 | +NAME LOCATION LOCATION_SCOPE SIZE_GB TYPE STATUS |
| 229 | +instance-20240914-173145-boot us-central1-a zone 150 pd-standard READY |
| 230 | +instance-20240914-173145-data-workspace us-central1-a zone 100 pd-balanced READY |
| 231 | +c4a-rhel-vm us-central1-a zone 50 hyperdisk-balanced READY <1> |
| 232 | +---- |
| 233 | +<1> Hyperdisk-balanced disk. |
| 234 | +
|
| 235 | +.. If using storage pools, check that the volume is provisioned as specified in your storage class and PVC by running the following command: |
| 236 | ++ |
| 237 | +[source, terminal] |
| 238 | +---- |
| 239 | +$ gcloud compute storage-pools list-disks pool-us-east4-c --zone=us-east4-c |
| 240 | +---- |
| 241 | ++ |
| 242 | +.Example output |
| 243 | ++ |
| 244 | +[source, terminal] |
| 245 | +---- |
| 246 | +NAME STATUS PROVISIONED_IOPS PROVISIONED_THROUGHPUT SIZE_GB |
| 247 | +pvc-1ff52479-4c81-4481-aa1d-b21c8f8860c6 READY 3000 140 2048 |
| 248 | +---- |
| 249 | +
|
0 commit comments