이 문서는 Google Distributed Cloud를 실행하는 애플리케이션 소유자 및 플랫폼 관리자를 대상으로 작성되었습니다. 이 문서에서는 GDC용 VM 런타임을 사용하는 VM의 스토리지 클래스를 만들고 사용하는 방법을 보여줍니다. StorageClass을 사용하면 VM의 다양한 요구를 충족하기 위해 다양한 스토리지 구성을 정의할 수 있습니다.
StorageClass을 사용하여 VM에 사용할 수 있는 스토리지 유형을 정의합니다. 다양한 스토리지 클래스가 여러 유형의 스토리지 하드웨어, 파일 시스템 또는 성능에 매핑될 수 있습니다. 스토리지 클래스를 만들고 사용하여 GDC용 VM 런타임에서 컴퓨팅 워크로드를 지원할 수 있습니다. 자세한 내용은 저장소 클래스를 참조하세요.
GDC용 VM 런타임에 대한 커스텀 리소스에 기본 StorageClass를 정의할 수 있습니다. VirtualMachineDisks,를 만들 때 특정 클래스를 정의하지 않으면 이 기본 StorageClass가 사용됩니다. 초기 StorageClass는 구성되지 않고 기본값으로 설정됩니다. 다음 섹션에서는 이 기본 StorageClass를 설정 또는 업데이트하는 방법을 알아봅니다.
기본 StorageClass 설정 또는 업데이트
처음에는 GDC용 VM 런타임을 사용하는 Google Distributed Cloud에 기본 StorageClass가 구성되어 있지 않습니다. StorageClass를 지정하지 않고 VirtualMachineDisk를 만들려면 먼저 StorageClass를 만든 다음 기본값으로 설정해야 합니다.
VirtualMachineDisk를 만들 때 GDC용 VM 런타임이 사용하는 기본 StorageClass를 처음 설정하거나 업데이트하려면 VMRuntime 커스텀 리소스를 업데이트합니다.
VMRuntime 커스텀 리소스를 수정합니다.
kubectleditvmruntime
사용할 기본 StorageClass를 지정하는 spec.storage 섹션을 추가하거나 업데이트합니다.
STORAGE_CLASS_NAME: 디스크에 사용할 StorageClass입니다. 이 StorageClass는 이미 존재해야 합니다. 먼저 StorageClass를 만들어야 하는 경우 StorageClass 만들기를 참조하세요.
편집기에서 디스크 매니페스트를 저장하고 닫습니다.
kubectl을 사용하여 디스크를 만듭니다.
kubectlapply-fmy-disk.yaml
스토리지 프로필 구성
스토리지 프로필은 각 StorageClass와 연결된 추가 구성 옵션을 제공합니다. 이러한 구성 옵션에는 StorageClass를 사용하는 VirtualMachineDisks에 사용할 액세스 모드 및 볼륨 모드가 포함됩니다.
구성된 스토리지 프로필이 없으면 디스크는 기본적으로 ReadWriteOnce 액세스 모드로 설정됩니다. 이 액세스 모드는 라이브 마이그레이션과 같은 기능이 작동하지 않기 때문에 프로덕션 워크로드에 충분하지 않습니다. 구성된 스토리지 프로필이 없는 기본 볼륨 모드는 Filesystem입니다.
GDC용 VM 런타임은 클러스터의 각 StorageClass에 대해 하나의 스토리지 프로필을 자동으로 생성합니다. 스토리지 프로필은 연결된 StorageClass와 이름이 동일합니다. 다음 출력 예시는 클러스터에 4개의 스토리지 클래스 및 연결된 프로필이 있음을 보여줍니다.
accessMode 및 volumeMode는 기본 Kubernetes 구성요소를 사용합니다.
설정하는 값은 사용하는 스토리지 드라이버에 따라 다릅니다. 사용하는 스토리지에 맞게 다음 값을 바꿉니다.
ACCESS_MODE: 사용하려는 액세스 모드입니다. 연결된 StorageClass에서 지원하는 경우 권장 액세스 모드는 ReadWriteMany입니다.
허용되는 값에는 ReadWriteOnce, ReadOnlyMany, ReadWriteMany, ReadWriteOncePod가 포함됩니다. 지정하지 않은 경우 GDC용 VM 런타임 기본값에 따라 ReadWriteOnce가 사용됩니다. 자세한 내용은 액세스 모드를 참조하세요.
VOLUME_MODE: 사용하려는 볼륨 모드입니다.
허용되는 값에는 Filesystem과 Block이 포함됩니다. 지정하지 않으면 Kubernetes 기본값에 따라 Filesystem이 사용됩니다. 자세한 내용은 볼륨 모드를 참조하세요.
편집기에서 StorageProfile 커스텀 리소스를 저장하고 닫습니다.
정의한 스토리지 프로필 설정은 이제 가상 디스크를 만들 때 사용됩니다. 기존 VirtualMachineDisk 리소스는 정의된 스토리지 프로필 설정을 사용하도록 업데이트되지 않습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["This document is intended for application owners and platform administrators\nthat run Google Distributed Cloud. This document shows you how to create and use\nstorage classes for VMs that use VM Runtime on GDC. A `StorageClass`\nlets you define different storage configurations to provide for the various\nneeds of your VMs.\n\nBefore you begin\n\nTo complete this document, you need access to Google Distributed Cloud version 1.12.0\n(`anthosBareMetalVersion: 1.12.0`) or higher cluster. You can use any cluster\ntype capable of running workloads. If needed,\n[try Google Distributed Cloud on Compute Engine](/kubernetes-engine/distributed-cloud/bare-metal/docs/try/gce-vms)\nor see the\n[cluster creation overview](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/creating-clusters/create-clusters-overview).\n\nStorage classes overview\n\nYou use a `StorageClass` to define the type of storage you make available to\nVMs. Different storage classes might map to a different type of storage\nhardware, file system, or performance. You can create and use storage classes to\nsupport your compute workloads in VM Runtime on GDC. For more\ninformation, see\n[Storage Classes](https://kubernetes.io/docs/concepts/storage/storage-classes/).\n\nA default `StorageClass` can be defined in the custom resource for\nVM Runtime on GDC. If you don't define a specific class when you\ncreate a `VirtualMachineDisks,` this default `StorageClass` is used. No initial\n`StorageClass` is configured and set as default. In the following section, you\nlearn how to\n[set or update this default StorageClass](#change-the-default-storageclass).\n\nSet or update the default StorageClass\n\nInitially, Google Distributed Cloud with VM Runtime on GDC have no default\n`StorageClass` configured. To create a `VirtualMachineDisk` without specifying a\n`StorageClass`, you must first\n[create a `StorageClass`](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/default-storage-class#create_storageclass)\nand then set it as default.\n\nIf you want to initially set or update the default `StorageClass` that\nVM Runtime on GDC uses when you create a `VirtualMachineDisk`, update\nthe `VMRuntime` custom resource.\n\n1. Edit the `VMRuntime` custom resource:\n\n kubectl edit vmruntime\n\n2. Add or update the `spec.storage` section that specifies the default\n `StorageClass` to use:\n\n apiVersion: vm.cluster.gke.io/v1\n kind: VMRuntime\n metadata:\n name: vmruntime\n spec:\n enabled: true\n storage:\n defaultStorageClass: \u003cvar label=\"storage_class_name\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eSTORAGE_CLASS_NAME\u003c/span\u003e\u003c/var\u003e\n ...\n\n Edit \u003cvar translate=\"no\"\u003eSTORAGE_CLASS_NAME\u003c/var\u003e with the name of the default\n `StorageClass` you want to use. If you need to first create a `StorageClass`,\n see\n [Create a `StorageClass`](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/default-storage-class#create_storageclass).\n3. Save and close the `VMRuntime` custom resource in your editor.\n\n The `StorageClass` you specified is now used when you now create a virtual\n machine disk and don't specify a `StorageClass`. The following section shows\n you how to\n [create a disk and use a specific StorageClass](#use-a-specific-storageclass).\n\n Existing `VirtualMachineDisk` resources are not updated to use the newly\n specified `StorageClass`.\n\nUse a specific StorageClass\n\nIf you don't want to use the default `StorageClass` when you create a\n`VirtualMachineDisk`, use the `storageClassName` field to specify a different\n`StorageClass`.\n\nTo use a specific, already-defined `StorageClass` when you create a\n`VirtualMachineDisk`, complete the following steps:\n\n1. Create a `VirtualMachineDisk` manifest, such as `my-disk.yaml`, in the\n editor of your choice:\n\n nano my-disk.yaml\n\n2. Copy and paste the following YAML manifest:\n\n apiVersion: vm.cluster.gke.io/v1\n kind: VirtualMachineDisk\n metadata:\n name: \u003cvar label=\"disk_name\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eDISK_NAME\u003c/span\u003e\u003c/var\u003e\n spec:\n size: 10Gi\n storageClassName: \u003cvar label=\"storage_class_name\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eSTORAGE_CLASS_NAME\u003c/span\u003e\u003c/var\u003e\n\n Replace the following values:\n - \u003cvar translate=\"no\"\u003eDISK_NAME\u003c/var\u003e: the name for your disk.\n - \u003cvar translate=\"no\"\u003eSTORAGE_CLASS_NAME\u003c/var\u003e: the `StorageClass` to use for your disk. This `StorageClass` must already exist. If you need to first create a `StorageClass`, see [Create a StorageClass](/kubernetes-engine/distributed-cloud/bare-metal/docs/installing/default-storage-class#create_storageclass).\n3. Save and close the disk manifest in your editor.\n\n4. Create the disk using `kubectl`:\n\n kubectl apply -f my-disk.yaml\n\nConfigure storage profiles\n\nStorage profiles provide extra configuration options associated with each\n`StorageClass`. These configuration options include which access mode and volume\nmode to use for `VirtualMachineDisks` that use the `StorageClass`.\n\nWithout a configured storage profile, disks default to the `ReadWriteOnce`\naccess mode. This access mode isn't sufficient for production workloads, as\nfeatures like live migration don't work. The default volume mode without a\nconfigured storage profile is `Filesystem`.\n\nVM Runtime on GDC automatically generates one storage profile for\neach `StorageClass` in a cluster. The storage profile is the same name as the\nassociated `StorageClass`. The following example output shows that the cluster\nhas four storage classes and associated profiles: \n\n $ kubectl get storageprofiles\n\n NAME AGE\n anthos-system 11d\n node-disk 11d\n standard 11d\n nfs 11d\n\nTo edit a storage profile and change the access mode or volume mode, complete\nthe following steps:\n\n1. Edit the `StorageProfile` custom resource for editing:\n\n kubectl edit storageprofile \u003cvar label=\"access_mode\" translate=\"no\"\u003eSTORAGE_PROFILE_NAME\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eSTORAGE_PROFILE_NAME\u003c/var\u003e with the `StorageProfile`\n you want to edit.\n2. Add a single entry to the `spec.claimPropertySets` list of the\n `StorageProfile`:\n\n apiVersion: cdi.kubevirt.io/v1beta1\n kind: StorageProfile\n metadata:\n name: nfs\n spec:\n claimPropertySets:\n - accessModes:\n - \u003cvar label=\"access_mode\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eACCESS_MODE\u003c/span\u003e\u003c/var\u003e\n volumeMode: \u003cvar label=\"volume_mode\" translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eVOLUME_MODE\u003c/span\u003e\u003c/var\u003e\n\n The `accessMode` and `volumeMode` use the underlying Kubernetes components.\n The values you set depend on the storage driver you use. Replace the following\n values as appropriate for the storage you use:\n - \u003cvar translate=\"no\"\u003eACCESS_MODE\u003c/var\u003e: the access mode that you want to use. If supported by the associated `StorageClass`, the preferred access mode is `ReadWriteMany`.\n - Acceptable values include `ReadWriteOnce`, `ReadOnlyMany`, `ReadWriteMany`, and `ReadWriteOncePod`. If not specified, `ReadWriteOnce` is used based on the VM Runtime on GDC defaults. For more information, see [Access modes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes).\n - \u003cvar translate=\"no\"\u003eVOLUME_MODE\u003c/var\u003e: the volume mode that you want to use.\n - Acceptable values include `Filesystem` and `Block`. If not specified, `Filesystem` is used based on the Kubernetes defaults. For more information, see [Volume modes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#volume-mode).\n\n | **Note:** The access mode and volume mode must be supported by the underlying `StorageClass`.\n3. Save and close the `StorageProfile` custom resource in your editor.\n\n The storage profile settings you defined are used when you now create any\n virtual disks. Existing `VirtualMachineDisk` resources are not updated to use\n the defined storage profile settings.\n\nWhat's next\n\n- [Create and manage disks in Google Distributed Cloud](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/create-manage-disks).\n- [Create and use credentials to import images from Cloud Storage](/kubernetes-engine/distributed-cloud/bare-metal/docs/vm-runtime/create-storage-credentials)."]]