copyright: years: 2014, 2019 lastupdated: "2019-09-27"
keywords: kubernetes, iks, vpc
subcollection: containers
{:new_window: target="_blank"} {:shortdesc: .shortdesc} {:screen: .screen} {:pre: .pre} {:table: .aria-labeledby="caption"} {:codeblock: .codeblock} {:tip: .tip} {:note: .note} {:important: .important} {:deprecated: .deprecated} {:download: .download} {:preview: .preview}
{: #vpc-block}
{{site.data.keyword.cloud_notm}} Block Storage for Virtual Private Cloud (VPC) provides hypervisor-mounted, high-performance data storage for your virtual server instances that you can provision within a VPC. {: shortdsc}
You can choose between predefined storage tiers with GB sizes and IOPS that meet the requirements of your workloads. To find out if VPC Block Storage is the right storage option for you, see Choosing a storage solution. For pricing information, see Pricing for Block Storage for VPC.
VPC Block Storage is available only for standard clusters that are provisioned on VPC infrastructure and that have all subnets configured with a public gateway. To use block storage in a cluster with classic {{site.data.keyword.cloud_notm}} infrastructure, see Storing data on classic {{site.data.keyword.cloud_notm}} Block Storage. VPC Block Storage is a single zone storage solution. If you have a multizone cluster, consider using one of the multizone persistent storage options. {: important}
VPC Block Storage is not removed when you remove the cluster or the PVC. Instead, follow the steps to manually remove VPC Block Storage from your cluster. {: important}
{: #vpc-block-addon}
Use an {{site.data.keyword.cloud_notm}} managed add-on to install the VPC Block Storage plug-in in your cluster. The add-on automatically installs the plug-in drivers and a set of pre-defined storage classes that you can use to provision VPC Block Storage in your cluster. {: shortdesc}
Before you install the VPC Block Storage add-on, make sure that your cluster's VPC subnets are configued with a public gateway. For more information, see step 12 in Creating a VPC and subnet. {: important}
-
Verify that your cluster runs the minimum required Kubernetes version for the VPC Block Storage plug-in.
-
List the Minimum Kubernetes version for the vpc-block-csi-driver add-on.
ibmcloud ks addon-versions --addon vpc-block-csi-driver
{: pre}
Example output:
OK Name Version Minimum Kubernetes version vpc-block-csi-driver 0.0.1 (default) 1.14
{: screen}
-
Make sure that your cluster runs the minimum required or a higher version of Kubernetes.
ibmcloud ks cluster ls
{: pre}
-
If your cluster does not meet the minimum Kubernetes version requirement, update your cluster.
-
-
List the add-ons that are installed in your cluster to verify that the vpc-block-csi-driver add-on is not yet enabled.
ibmcloud ks cluster addons --cluster <cluster_name_or_ID>
{: pre}
If the VPC Block Storage add-on is displayed in your CLI output, the add-on is already installed in your cluster.
-
If the add-on is not installed, enable the add-on in your cluster.
ibmcloud ks cluster addon enable vpc-block-csi-driver --cluster <cluster_name_or_ID>
{: pre}
Example output:
OK
{: screen}
-
Verify that the VPC Block Storage add-on is successfully installed.
kubectl get pod -n kube-system | grep vpc
{: pre}
Example output:
ibm-vpc-block-csi-controller-0 3/3 Running 0 79s ibm-vpc-block-csi-node-pvpnf 2/2 Running 0 78s
{: screen}
The installation is successful when you see one
ibm-vpc-block-csi-controller
and one or moreibm-vpc-block-csi-node
pods. The number ofibm-vpc-block-csi-node
pods equals the number of worker nodes in your cluster. -
Verify that the VPC Block Storage storage classes are created in your cluster.
kubectl get storageclasses | grep vpc
{: pre}
Example output:
ibmc-vpc-block-10iops-tier vpc.block.csi.ibm.io 72m ibmc-vpc-block-5iops-tier vpc.block.csi.ibm.io 72m ibmc-vpc-block-custom vpc.block.csi.ibm.io 72m ibmc-vpc-block-general-purpose vpc.block.csi.ibm.io 72m ibmc-vpc-block-retain-10iops-tier vpc.block.csi.ibm.io 72m ibmc-vpc-block-retain-5iops-tier vpc.block.csi.ibm.io 72m ibmc-vpc-block-retain-custom vpc.block.csi.ibm.io 72m ibmc-vpc-block-retain-general-purpose vpc.block.csi.ibm.io 72m
{: screen}
{: #vpc-block-add}
Choose your VPC Block Storage profile and create a persistent volume claim to dynamically provision VPC Block Storage for your cluster. Dynamic provisioning automatically creates the matching persistent volume and orders the physical storage device in your {{site.data.keyword.cloud_notm}} account. {: shortdesc}
-
Decide on the VPC Block Storage profile that best meets the capacity and performance requirements that you want.
-
Select the corresponding storage class for your VPC Block Storage profile.
All IBM pre-defined storage classes set up VPC Block Storage with an
ext4
file system by default. If you want to use a different file system, such asxfs
orext3
, create a customized storage class. {: note}Overview of VPC Block Storage profiles VPC Block Storage profile Corresponding storage class 10 IOPS/GB ibmc-vpc-block-10iops-tier
ibmc-vpc-block-retain-10iops-tier
5 IOPS/GB ibmc-vpc-block-5iops-tier
ibmc-vpc-block-retain-5iops-tier
3 IOPS/GB ibmc-vpc-block-general-purpose
ibmc-vpc-block-retain-general-purpose
Custom ibmc-vpc-block-custom
ibmc-vpc-block-retain-custom
-
Decide on your VPC Block Storage configuration.
- Choose a size for your storage. Make sure that the size is supported by the VPC Block Storage profile that you chose.
- Choose if you want to keep your data after the cluster or the persistent volume claim (PVC) is deleted.
- If you want to keep your data, then choose a
retain
storage class. When you delete the PVC, only the PVC is deleted. The persistent volume (PV), the physical storage device in your {{site.data.keyword.cloud_notm}} account, and your data still exist. To reclaim the storage and use it in your cluster again, you must remove the PV and follow the steps for using existing VPC Block Storage. - If you want the PV, the data, and your physical VPC Block Storage device to be deleted when you delete the PVC, choose a storage class without
retain
.
- If you want to keep your data, then choose a
-
Create a configuration file to define your persistent volume claim and save the configuration as a YAML file.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: <pvc_name> spec: accessModes: - ReadWriteOnce resources: requests: storage: <size> storageClassName: <storage_class>
{: codeblock}
Understanding the YAML file components -
Create the PVC in your cluster.
kubectl apply -f pvc.yaml
{: pre}
-
Verify that your PVC is created and bound to the PV. This process can take a few minutes.
kubectl describe pvc <pvc_name>
{: pre}
Example output:
Name: mypvv Namespace: default StorageClass: ibmc-vpc-block-5iops-tier Status: Bound Volume: Labels: <none> Annotations: kubectl.kubernetes.io/last-applied-configuration: {"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{},"name":"csi-block-pvc-good","namespace":"default"},"spec":{... volume.beta.kubernetes.io/storage-provisioner: vpc.block.csi.ibm.io Finalizers: [kubernetes.io/pvc-protection] Capacity: 10Gi Access Modes: VolumeMode: Filesystem Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal ExternalProvisioning 9s (x3 over 18s) persistentvolume-controller waiting for a volume to be created, either by external provisioner "vpc.block.csi.ibm.io" or manually created by system administrator Mounted By: <none>
{: screen}
-
Create a deployment configuration file for your app and mount the PVC to your app.
apiVersion: apps/v1 kind: Deployment metadata: name: <deployment_name> labels: app: <deployment_label> spec: selector: matchLabels: app: <app_name> template: metadata: labels: app: <app_name> spec: containers: - image: <image_name> name: <container_name> volumeMounts: - name: <volume_name> mountPath: /<file_path> volumes: - name: <volume_name> persistentVolumeClaim: claimName: <pvc_name>
{: codeblock}
Understanding the YAML file components -
Create the deployment in your cluster.
kubectl apply -f deployment.yaml
{: pre}
-
Verify that the PVC is successfully mounted to your app. It might take a few minutes for your pods to get into a Running state.
During the deployment of your app, you might see intermittent
Unable to mount volumes
errors in the Events section of your CLI output. The VPC Block Storage add-on automatically retries mounting the storage to your apps. Wait a few more minutes for the storage to mount to your app. {: tip}kubectl describe deployment <deployment_name>
{: pre}
Example output:
... Volumes: myvol: Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace) ClaimName: mypvc ReadOnly: false
{: screen}
{: #vpc-block-static}
If you have an existing physical VPC Block Storage device that you want to use in your cluster, you can manually create the PV and PVC to statically provision the storage. {: shortdesc}
-
From the VPC Block Storage dashboard {: new_window}, select the VPC Block Storage device that you want to add to your cluster.
-
From the volumes details page, note the ID, Size, Location, and Max IOPS of your VPC Block Storage device.
-
Optional: If you provisioned your physical VPC Block Storage instance by using a
retain
VPC Block Storage class, the PV and the physical storage is not removed when you remove the PVC. To use your physical VPC Block Storage device in your cluster, you must remove the existing PV first.-
List the PVs in your cluster and look for the PV that belongs to your VPC Block Storage device. The PV is in a
released
state.kubectl get pv
{: pre}
-
Remove the PV.
kubectl delete pv <pv_name>
{: pre}
-
-
Create a configuration file for your PV. Include the ID, Size, Location, and Max IOPS that you retrieved earlier.
apiVersion: v1 kind: PersistentVolume metadata: name: <pv_name> spec: accessModes: - ReadWriteOnce capacity: storage: <vpc_block_storage_size> csi: driver: vpc.block.csi.ibm.io fsType: ext4 volumeAttributes: iops: "<vpc_block_storage_iops>" volumeId: <vpc_block_storage_ID> zone: "<vpc_block_location>" volumeHandle: <vpc_block_storage_ID> persistentVolumeReclaimPolicy: Retain storageClassName: "" volumeMode: Filesystem
{: codeblock}
Understanding the YAML file components -
Create the PV in your cluster.
kubectl apply -f pv.yaml
{: pre}
-
Verify that the PV is created in your cluster.
kubectl get pv
{: pre}
-
Create another configuration file for your PVC. In order for the PVC to match the PV that you created earlier, you must choose the same value for the storage size and access mode. In your storage class field, enter an empty string value to match your PV. If any of these fields do not match the PV, then a new PV and VPC Block Storage instance are created automatically via dynamic provisioning.
apiVersion: v1 kind: PersistentVolumeClaim metadata: name: <pvc_name> spec: accessModes: - ReadWriteOnce resources: requests: storage: <vpc_block_storage_size> storageClassName: ""
{: codeblock}
-
Create your PVC.
kubectl apply -f pvc.yaml
{: pre}
-
Verify that your PVC is created and bound to the PV that you created earlier. This process can take a few minutes.
kubectl describe pvc <pvc_name>
{: pre}
{: #vpc-block-xfs}
You can create a customized storage class to provision VPC Block Storage with a different file system, such as xfs
or ext3
. By default, all VPC Block Storage instances are provisioned with an ext4
file system.
{: shortdesc}
-
Follow the steps to create a customized storage class with the file system that you want to use.
Example storage class:
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: <storage_class_name> parameters: billingType: hourly classVersion: "1" csi.storage.k8s.io/fstype: <file_system_type> encrypted: "false" encryptionKey: "" generation: gc profile: general-purpose resourceGroup: "" sizeRange: '[10-2000]GiB' tags: "" zone: "" provisioner: vpc.block.csi.ibm.io reclaimPolicy: Delete volumeBindingMode: Immediate
{: codeblock}
Understanding the YAML file components -
Follow step 4-9 in Adding VPC Block Storage to your apps to create a PVC with your customized storage class to provision VPC Block Storage with a different file system. Then, mount this storage to a sample app.
Your app might take a few minutes to mount the storage and get into a Running state. {: note}
-
Verify that your storage is mounted with the correct file system.
-
List the pods in your cluster and note the Name of the pod that you used to mount your storage.
kubectl get pod
{: pre}
-
Log in to your pod.
kubectl exec <pod_name> -it bash
{: pre}
-
List the mount paths inside your pod.
mount | grep /dev/xvdg
{: pre}
Example output for
xfs
:/dev/xvdg on /test type xfs (rw,relatime,attr2,inode64,noquota)
{: pre}
-
Exit your pod.
exit
{: pre}
-
{: #vpc-block-encryption}
Use {{site.data.keyword.keymanagementservicelong}} to create a private root key that you use in your VPC Block Storage instance to encrypt data as it is written to the storage. After you create the private root key, create a custom storage class or a Kubernetes secret with your root key and then use this storage class or secret to provision your VPC Block Storage instance. {: shortdesc}
-
Create a {{site.data.keyword.keymanagementserviceshort}} service instance.
-
Create a root key. By default, the root key is created without an expiration date.
-
Retrieve the service CRN for your root key.
- From the {{site.data.keyword.keymanagementserviceshort}} details page, select the Manage tab to find the list of your keys.
- Find the root key that you created and from the actions menu, click View CRN.
- Note the CRN of your root key.
-
Authorize VPC Block Storage to access {{site.data.keyword.keymanagementservicelong}}.
- From the {{site.data.keyword.cloud_notm}} menu, select Manage > Access (IAM).
- From the menu, select Authorizations.
- Click Create.
- Select Cloud Block Storage as your source service.
- Select Key Protect as your target service.
- Select the Reader service access role and click Authorize.
-
Decide if you want to store the {{site.data.keyword.keymanagementserviceshort}} root key CRN in a customized storage class or in a Kubernetes secret. Then, follow the steps to create a customized storage class or a Kubernetes secret.
Example customized storage class:
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: <storage_class_name> provisioner: vpc.block.csi.ibm.io parameters: profile: "5iops-tier" sizeRange: "[10-2000]GiB" csi.storage.k8s.io/fstype: "ext4" billingType: "hourly" encrypted: "true" encryptionKey: "<encryption_key>" resourceGroup: "" zone: "" tags: "" generation: "gc" classVersion: "1" reclaimPolicy: "Delete"
{: codeblock}
Understanding the YAML file components Example Kubernetes secret:
apiVersion: v1 kind: Secret type: vpc.block.csi.ibm.io metadata: name: <secret_name> namespace: <namespace_name> stringData: encrypted: <true_or_false> data encryptionKey: <encryption_key>
{: codeblock}
Understanding the YAML file components -
Follow step 4-9 in Adding VPC Block Storage to your apps to create a PVC with your customized storage class to provision VPC Block Storage that is configured for encryption with your {{site.data.keyword.keymanagementserviceshort}} root key. Then, mount this storage to a sample app.
Your app might take a few minutes to mount the storage and get into a Running state. {: note}
-
Verify that your data is encrypted.
-
List your VPC Block Storage volumes and note the ID of the VPC Block Storage instance that you created. The storage instance Name equals the name of the PV that was automatically created when you created the PVC.
ibmcloud is vols
{: pre}
Example output:
ID Name Status Capacity IOPS Profile Attachment type Created Zone Resource group a395b603-74bf-4703-8fcb-b68e0b4d6960 pvc-479d590f-ca72-4df2-a30a-0941fceeca42 available 10 3000 5iops-tier data 2019-08-17T12:29:18-05:00 us-south-1 a8a12accd63b437bbd6d58fb6a462ca7
{: screen}
-
Using the volume ID, list the details for your VPC Block Storage instance to ensure that your {{site.data.keyword.keymanagementserviceshort}} root key is stored in the storage instance. You can find the root key in the Encryption key field of your CLI output.
ibmcloud is vol <volume_ID>
{: codeblock}
Example output:
ID a395b603-74bf-4703-8fcb-b68e0b4d6960 Name pvc-479d590f-ca72-4df2-a30a-0941fceeca42 Status available Capacity 10 IOPS 3000 Profile 5iops-tier Encryption key crn:v1:bluemix:public:kms:us-south:a/6ef045fd2b43266cfe8e6388dd2ec098:53369322-958b-421c-911a-c9ae8d5156d1:key:47a985d1-5f5e-4477-93fc-12ce9bae343f Encryption user_managed Resource group a8a12accd63b437bbd6d58fb6a462ca7 Created 2019-08-17T12:29:18-05:00 Zone us-south-1 Volume Attachment Instance Reference
{: screen}
-
{: #vpc-customize-default}
You can change some of the default PVC settings by using a customized storage class or a Kubernetes secret to create VPC Block Storage with your customized settings. {: shortdesc}
What is the benefit of using a secret and specifying my parameters in a customized storage class?
As a cluster admin, create a customized storage class when you want all of the PVCs that your cluster users create to be provisioned with a specific configuration and you don't want to enable your cluster users to override the default configuration.
However, when multiple configurations are required and you don't want to create a customized storage class for every possible PVC configuration, you can create one customized storage class with the default PVC settings and a reference to a generic Kubernetes secret. If your cluster users must override the default settings of your customized storage class, they can do so by creating a Kubernetes secret that holds their custom settings.
When you want to set up encryption for your VPC Block Storage instance, you can also use a Kubernetes secret if you want to encode the {{site.data.keyword.keymanagementserviceshort}} root key CRN to base64 instead of providing the key directly in the customized storage class.
{: #vpc-customize-storage-class}
Use one of the IBM-provided storage classes as a basis to create your own customized storage class with the preferred settings for your VPC Block Storage. {: shortdesc}
-
Review step 1 and 2 in Adding VPC Block Storage to your apps to find the pre-defined storage class that best meets the performance and capacity requirements of your app. This storage class is used as the basis to create your own customized storage class.
-
Retrieve the YAML file for the storage class that you want to use as the basis to create your own customized storage class. For example, the following command retrieves the YAML file for the
ibmc-vpc-block-5iops-tier
storage class.kubectl get storageclass ibmc-vpc-block-5iops-tier -o yaml
{: pre}
Example output:
apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: annotations: armada-service: addon-vpc-block-csi-driver kubectl.kubernetes.io/last-applied-configuration: | {"apiVersion":"storage.k8s.io/v1","kind":"StorageClass","metadata":{"annotations":{"armada-service":"addon-vpc-block-csi-driver","version":"0.0.1_57"},"labels":{"addonmanager.kubernetes.io/mode":"Reconcile","app":"ibm-vpc-block-csi-driver"},"name":"ibmc-vpc-block-5iops-tier"},"parameters":{"billingType":"hourly","classVersion":"1","csi.storage.k8s.io/fstype":"ext4","encrypted":"false","encryptionKey":"","generation":"gc","profile":"5iops-tier","resourceGroup":"","sizeRange":"[10-2000]GiB","tags":"","zone":""},"provisioner":"vpc.block.csi.ibm.io","reclaimPolicy":"Delete"} version: 0.0.1_57 creationTimestamp: "2019-08-02T20:29:29Z" labels: addonmanager.kubernetes.io/mode: Reconcile app: ibm-vpc-block-csi-driver name: ibmc-vpc-block-5iops-tier resourceVersion: "458548" selfLink: /apis/storage.k8s.io/v1/storageclasses/ibmc-vpc-block-5iops-tier uid: 94a920c6-cfda-4a57-9332-1f9b78881d50 parameters: billingType: hourly classVersion: "1" csi.storage.k8s.io/fstype: ext4 encrypted: "false" encryptionKey: "" generation: gc profile: 5iops-tier resourceGroup: "" sizeRange: '[10-2000]GiB' tags: "" zone: "" provisioner: vpc.block.csi.ibm.io reclaimPolicy: Delete volumeBindingMode: Immediate
{: screen}
-
Create a customized storage class YAML file that is based on the YAML file that you retrieved. You can streamline your YAML file by removing all of the information from the
metadata
section, except for thename
.apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: <storage_class_name> provisioner: vpc.block.csi.ibm.io parameters: profile: "5iops-tier" sizeRange: "<size_range>" csi.storage.k8s.io/fstype: "<file_system_type>" billingType: "hourly" encrypted: "<encrypted_true_false>" encryptionKey: "<encryption_key>" resourceGroup: "" zone: "<zone>" tags: "<tags>" generation: "gc" classVersion: "1" reclaimPolicy: "<reclaim_policy>" volumeBindingMode: <volume_binding_mode>
{: codeblock}
Understanding the YAML file components -
Create the customized storage class in your cluster.
kubectl apply -f custom_storageclass.yaml
{: pre}
-
Verify that your storage class is available in the cluster.
kubectl get storageclasses
{: pre}
Example output:
NAME PROVISIONER AGE ibmc-vpc-block-10iops-tier vpc.block.csi.ibm.io 4d21h ibmc-vpc-block-5iops-tier vpc.block.csi.ibm.io 4d21h ibmc-vpc-block-custom vpc.block.csi.ibm.io 4d21h ibmc-vpc-block-general-purpose vpc.block.csi.ibm.io 4d21h ibmc-vpc-block-retain-10iops-tier vpc.block.csi.ibm.io 4d21h ibmc-vpc-block-retain-5iops-tier vpc.block.csi.ibm.io 4d21h ibmc-vpc-block-retain-custom vpc.block.csi.ibm.io 4d21h ibmc-vpc-block-retain-general-purpose vpc.block.csi.ibm.io 4d21h custom_storageclass vpc.block.csi.ibm.io 4m26s
{: screen}
-
Follow the steps in Adding VPC Block Storage to your apps to create a PVC with your customized storage class to provision VPC Block Storage. Then, mount this storage to a sample app.
{: #vpc-block-storageclass-secret}
Specify your PVC settings in a Kubernetes secret and reference this secret in a customized storage class. Then, use the customized storage class to create a PVC with the custom parameters that you set in your secret. {: shortdesc}
What options do I have to use the Kubernetes secret?
As a cluster admin, you can choose if you want to allow each cluster user to override the default settings of a storage class, or if you want to create one secret that everyone in your cluster must use and that enforces base64 encoding for your {{site.data.keyword.keymanagementserviceshort}} root key CRN.
-
Every user can customize the default settings: In this scenario, the cluster admin creates one customized storage class with the default PVC settings and a reference to a generic Kubernetes secret. Cluster users can override the default settings of the storage class by creating a Kubernetes secret with the desired PVC settings. In order for the customized settings in the secret to get applied to your VPC Block Storage, you must create a PVC with the same name as your Kubernetes secret.
-
Enforce base64 encoding for the {{site.data.keyword.keymanagementserviceshort}} root key: In this scenario, you create one customized storage class with the default PVC settings and a reference to a static Kubernetes secret that overrides or enhances the default settings of the customized storage class. Your cluster users cannot override the default settings by creating their own Kubernetes secret. Instead, cluster users must provision VPC Block Storage with the configuration that you chose in your customized storage class and secret. The benefit of using this method over creating a customized storage class only is that you can enforce base64 encoding for the root key CRN of your {{site.data.keyword.keymanagementserviceshort}} service instance when you want to encrypt the data in your VPC Block Storage instance.
What do I need to be aware of before I start using the Kubernetes secret for my PVC settings?
Some of the PVC settings, such as the reclaimPolicy
, fstype
, or the volumeBindingMode
cannot be set in the Kubernetes secret and must be set in the storage class. As the cluster admin, if you want to enable your cluster users to override your default settings, you must ensure that you set up enough customized storage classes that reference a generic Kubernetes secret so that your users can provision VPC Block Storage with different reclaimPolicy
, fstype
, and volumeBindingMode
settings.
{: #customize-with-secret}
-
As the cluster admin, follow the steps to create a customized storage class. In the customized storage class YAML file, reference the Kubernetes secret in the
metadata.annotation
section as follows. Make sure to add the code as-is and not to change variables names.csi.storage.k8s.io/provisioner-secret-name: ${pvc.name} csi.storage.k8s.io/provisioner-secret-namespace: ${pvc.namespace}
{: codeblock}
-
As the cluster user, create a Kubernetes secret that customizes the default settings of the storage class.
apiVersion: v1 kind: Secret type: vpc.block.csi.ibm.io metadata: name: <secret_name> namespace: <namespace_name> stringData: iops: "<IOPS_value>" zone: "<zone>" tags: "<tags>" encrypted: <true_or_false> resourceGroup: "<resource_group>" data encryptionKey: <encryption_key>
{: codeblock}
Understanding the YAML file components -
Create your Kubernetes secret.
kubectl apply -f secret.yaml
{: pre}
-
Follow the steps in Adding VPC Block Storage to your apps to create a PVC with your custom settings. Make sure to create the PVC with the customized storage class that the cluster admin created and use the same name for your PVC that you used for your secret. Using the same name for the secret and the PVC triggers the storage provider to apply the settings of the secret in your PVC.
{: #static-secret}
-
As the cluster admin, create a Kubernetes secret that includes the base64 encoded value for your {{site.data.keyword.keymanagementserviceshort}} root key CRN. To retrieve the root key CRN, see Setting up encryption for your VPC Block Storage.
apiVersion: v1 kind: Secret type: vpc.block.csi.ibm.io metadata: name: <secret_name> namespace: <namespace_name> stringData: encrypted: <true_or_false> resourceGroup: "<resource_group>" data encryptionKey: <encryption_key>
{: codeblock}
Understanding the YAML file components -
Create the Kubernetes secret.
kubectl apply -f secret.yaml
{: pre}
-
Follow the steps to create a customized storage class. In the customized storage class YAML file, reference the Kubernetes secret in the
metadata.annotation
section as follows. Make sure to enter the name of the Kubernetes secret that you created earlier and the namespace where you created the secret.csi.storage.k8s.io/provisioner-secret-name: <secret_name> csi.storage.k8s.io/provisioner-secret-namespace: <secret_namespace>
{: codeblock}
-
As the cluster user, follow the steps in Adding VPC Block Storage to your apps to create a PVC from your customized storage class.
{: #vpc-block-backup-restore}
Data that is stored on VPC Block Storage is secured across redundant fault zones in your region. To manually back up your data, use the Kubernetes kubectl cp
command.
{: shortdesc}
You can use the kubectl cp
command to copy files and directories to and from pods or specific containers in your cluster
Before you begin: Log in to your account. If applicable, target the appropriate resource group. Set the context for your cluster.
To back up or restore data, choose between the following options:
-
Copy data from your local machine to a pod in your cluster:
kubectl cp <local_filepath>/<filename> <namespace>/<pod>:<pod_filepath>
{: pre}
-
Copy data from a pod in your cluster to your local machine:
kubectl cp <namespace>/<pod>:<pod_filepath>/<filename> <local_filepath>/<filename>
{: pre}
-
Copy data from your local machine to a specific container that runs in a pod in your cluster:
kubectl cp <local_filepath>/<filename> <namespace>/<pod>:<pod_filepath> -c <container>
{: pre}
{: #vpc-block-reference}
Characteristics | Setting |
---|---|
Name | ibmc-vpc-block-10iops-tier ibmc-vpc-block-retain-10iops-tier |
File system | ext4 |
Corresponding VPC Block Storage tier | 10 IOPS/GB |
Billing | Hourly |
Pricing | Pricing information |
{: class="simple-tab-table"} | |
{: caption="VPC Block Storage class: 10 IOPS-tier" caption-side="top"} | |
{: #vpc-block-10iops} | |
{: tab-title="10 IOPS-tier"} | |
{: tab-group="VPC block storage class"} |
Characteristics | Setting |
---|---|
Name | ibmc-vpc-block-5iops-tier ibmc-vpc-block-retain-5iops-tier |
File system | ext4 |
Corresponding VPC Block Storage tier | 5 IOPS/GB |
Billing | Hourly |
Pricing | Pricing information |
{: class="simple-tab-table"} | |
{: caption="VPC Block Storage class: 5 IOPS-tier" caption-side="top"} | |
{: #vpc-block-5iops} | |
{: tab-title="5 IOPS-tier"} | |
{: tab-group="VPC block storage class"} |
Characteristics | Setting |
---|---|
Name | ibmc-vpc-block-custom ibmc-vpc-block-retain-custom |
File system | ext4 |
Corresponding VPC Block Storage tier | Custom |
Billing | Hourly |
Pricing | Pricing information |
{: class="simple-tab-table"} | |
{: caption="VPC Block Storage class: custom" caption-side="top"} | |
{: #vpc-block-custom} | |
{: tab-title="Custom"} | |
{: tab-group="VPC block storage class"} |
Characteristics | Setting |
---|---|
Name | ibmc-vpc-block-general-purpose ibmc-vpc-block-retain-general-purpose |
File system | ext4 |
Corresponding VPC Block Storage tier | 3 IOPS/GB |
Billing | Hourly |
Pricing | Pricing information |
{: class="simple-tab-table"} | |
{: caption="VPC Block Storage class: 3 IOPS-tier" caption-side="top"} | |
{: #vpc-block-3iops} | |
{: tab-title="General purpose"} | |
{: tab-group="VPC block storage class"} |