หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
This tutorial introduces Azure Container Storage and demonstrates how to deploy and manage container-native storage for applications running on Azure Kubernetes Service (AKS). If you don't want to deploy Azure Container Storage now, you can skip this tutorial and proceed directly to Deploy an application in AKS. You won't need Azure Container Storage for the basic storefront application in this tutorial series.
Azure Container Storage simplifies the management of stateful applications in Kubernetes by offering container-native storage tailored to a variety of workloads, including databases, analytics platforms, and high-performance applications.
By the end of this tutorial, you will:
- Understand how Azure Container Storage supports diverse workloads in Kubernetes.
- Deploy Azure Container Storage on your AKS cluster.
- Create a generic ephemeral volume.
Before you begin
In previous tutorials, you created a container image, uploaded it to an ACR instance, and created an AKS cluster. Start with Tutorial 1 - Prepare application for AKS to follow along.
Confirm that your target region is supported by reviewing the Azure Container Storage regional availability.
Install the latest version of the Azure CLI (2.83.0 or later), then sign in with
az login. Don't use Azure Cloud Shell, becauseaz upgradeisn't available.Install the Kubernetes command-line client,
kubectl. You can install it locally by runningaz aks install-cli.
Important
This tutorial applies to Azure Container Storage (version 2.x.x), which supports local NVMe disk and Azure Elastic SAN as backing storage types. This tutorial uses local NVMe and creates a generic ephemeral volume. To use local NVMe, your VM SKU must support local NVMe data disks, such as storage-optimized or GPU-accelerated VMs.
If you'd prefer to use Azure Elastic SAN, see Use Azure Container Storage with Azure Elastic SAN.
Install the Kubernetes extension
Add or upgrade to the latest version of k8s-extension by running the following command.
az extension add --upgrade --name k8s-extension
Enable Azure Container Storage on your AKS cluster
Run the following command to enable Azure Container Storage on an existing AKS cluster using local NVMe. Azure Container Storage installs the latest available version and updates itself automatically. Manual version selection isn't supported.
az aks update -n myAKSCluster -g myResourceGroup --enable-azure-container-storage ephemeralDisk
The deployment can take up to five minutes. When it completes, the AKS cluster has Azure Container Storage installed and the components for local NVMe storage type deployed. It also creates the default local storage class.
Connect to the cluster and verify status
If you're not already connected to your cluster from the previous tutorial, run the following commands. If you're already connected, you can skip this section.
Download the cluster credentials and configure the Kubernetes CLI to use them. By default, credentials are stored in
~/.kube/config. Provide a different path by using the--fileargument if needed.az aks get-credentials --resource-group myResourceGroup --name myAKSClusterVerify the connection by listing the cluster nodes.
kubectl get nodesMake sure all nodes report a status of
Ready.
Verify the storage class
Run the following command to verify that the storage class is created:
kubectl get storageclass local
You should see output similar to:
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
local localdisk.csi.acstor.io Delete WaitForFirstConsumer true 10s
Deploy a pod with generic ephemeral volume
Create a pod using Fio (Flexible I/O Tester) for benchmarking and workload simulation that uses a generic ephemeral volume.
Use your favorite text editor to create a YAML manifest file such as
code fiopod.yaml.Paste in the following code and save the file.
kind: Pod apiVersion: v1 metadata: name: fiopod spec: nodeSelector: "kubernetes.io/os": linux containers: - name: fio image: mayadata/fio args: ["sleep", "1000000"] volumeMounts: - mountPath: "/volume" name: ephemeralvolume volumes: - name: ephemeralvolume ephemeral: volumeClaimTemplate: spec: volumeMode: Filesystem accessModes: ["ReadWriteOnce"] storageClassName: local resources: requests: storage: 10GiApply the YAML manifest file to deploy the pod.
kubectl apply -f fiopod.yaml
Verify the deployment and run benchmarks
Check that the pod is running:
kubectl get pod fiopod
You should see the pod in the Running state. Once running, you can execute a Fio benchmark test:
kubectl exec -it fiopod -- fio --name=benchtest --size=800m --filename=/volume/test --direct=1 --rw=randrw --ioengine=libaio --bs=4k --iodepth=16 --numjobs=8 --time_based --runtime=60
You've now deployed a pod that's using local NVMe as its storage, and you can use it for your Kubernetes workloads.
To learn more about Azure Container Storage, see What is Azure Container Storage?
Clean up resources
You won't need Azure Container Storage for the rest of this tutorial series, so we recommend deleting it now to avoid incurring unnecessary Azure charges.
Delete the pod.
kubectl delete pod fiopodDelete the generic ephemeral volume.
kubectl delete pv ephemeralvolumeDelete the extension instance.
az aks update -n myAKSCluster -g myResourceGroup --disable-azure-container-storage
Next step
In this tutorial, you deployed Azure Container Storage on your AKS cluster. You learned how to:
- Enable Azure Container Storage on your AKS cluster.
- Deploy a pod with a generic ephemeral volume.
In the next tutorial, you learn how to deploy an application to your cluster.