Notitie
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen u aan te melden of de directory te wijzigen.
Voor toegang tot deze pagina is autorisatie vereist. U kunt proberen de mappen te wijzigen.
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.
- Explore multiple storage backend options to tailor storage to your application's needs.
- Deploy Azure Container Storage on your AKS cluster and create a generic ephemeral volume.
Voordat u begint
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.
- This tutorial requires using the Azure CLI version 2.35.0 or later. Portal and PowerShell aren't currently supported for Azure Container Storage. Controleer uw versie met
az --version. Voor het installeren of upgraden, zie Azure CLI installeren. Als u de Bash-omgeving in Azure Cloud Shell gebruikt, is de nieuwste versie al geïnstalleerd. - You must have an existing Linux-based AKS cluster with at least 3 nodes with Storage optimized VM SKUs or GPU accelerated VM SKUs. See Tutorial 3 - Create an AKS cluster.
- U hebt de Kubernetes-opdrachtregelclient nodig.
kubectlDeze is al geïnstalleerd als u Azure Cloud Shell gebruikt of als u deze lokaal kunt installeren door de opdracht uit teaz aks install-clivoeren.
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
Connect to the cluster and check node 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.
Run the following command to connect to the cluster.
az aks get-credentials --resource-group myResourceGroup --name myAKSClusterControleer de verbinding met uw cluster met behulp van de
kubectl getopdracht. Met deze opdracht wordt een lijst met de clusterknooppunten geretourneerd.kubectl get nodesIn het volgende uitvoervoorbeeld ziet u de knooppunten in uw cluster. Controleer of de status voor alle knooppunten Gereed is:
NAME STATUS ROLES AGE VERSION aks-nodepool1-34832848-vmss000000 Ready agent 80m v1.30.9 aks-nodepool1-34832848-vmss000001 Ready agent 80m v1.30.9 aks-nodepool1-34832848-vmss000002 Ready agent 80m v1.30.9
Choose a backing storage option
Azure Container Storage uses storage pools to provision and manage persistent and generic volumes. It offers a variety of back-end storage options for your storage pools, each suited for specific workloads. Selecting the right storage type is critical for optimizing workload performance, durability, and cost efficiency. For this tutorial, we'll use Ephemeral Disk with local NVMe as backing storage to create a generic ephemeral volume. However, we'll also explore the other backing storage options that allow you to create persistent volumes.
Tijdelijke schijf
Ephemeral Disk utilizes local storage resources on the AKS nodes (either local NVMe or temp SSD). It offers low sub-ms latency and high IOPS, but no data persistence if the VM restarts. Ephemeral Disk is best suited for applications such as Cassandra that prioritize speed over persistence, and is ideal for workloads with their own application-level replication.
You can use Ephemeral Disk to create either generic ephemeral volumes or persistent volumes, even though the data will be lost if the VM restarts.
Azure Disks
Ideal for databases like PostgreSQL and MongoDB, Azure Disks offer durability, scalability, and multi-tiered performance options, including Premium SSD and Ultra SSD.
Azure Disks allow for automatic provisioning of storage volumes and include built-in redundancy and high availability.
Azure Elastic SAN (preview)
Designed for shared storage needs and general-purpose databases requiring scalability and high availability, Azure Elastic SAN is a good fit for workloads such as CI/CD pipelines or large-scale data processing.
Enable Azure Container Storage and create a storage pool
Run the following command to install Azure Container Storage on the cluster and create a Local NVMe storage pool.
az aks update -n myAKSCluster -g myResourceGroup --enable-azure-container-storage ephemeralDisk --storage-pool-option NVMe
The deployment should take less than 15 minutes.
Verify the storage pool status
When deployment completes, the components for your chosen storage pool type will be enabled, and you'll have a default storage pool.
To get the list of available storage pools, run the following command:
kubectl get sp -n acstor
To check the status of a storage pool, run the following command:
kubectl describe sp <storage-pool-name> -n acstor
If the Message doesn't say StoragePool is ready, then your storage pool is still creating or ran into a problem.
Display the available storage classes
Wanneer de opslaggroep klaar is voor gebruik, moet u een opslagklasse selecteren om te definiëren hoe opslag dynamisch wordt gemaakt bij het maken en implementeren van volumes.
Voer uit kubectl get sc om de beschikbare opslagklassen weer te geven. U zou een opslagklasse met de naam acstor-<storage-pool-name> moeten zien. Use this storage class in the next section to deploy a pod.
Deploy a pod with a generic ephemeral volume
Maak een pod met Fio (Flexible I/O Tester) voor benchmarking en workloadsimulatie, die gebruikmaakt van een generiek ephemerisch volume.
Gebruik uw favoriete teksteditor om een YAML-manifestbestand, zoals
code acstor-pod.yaml, aan te maken.Plak de volgende code en sla het bestand op.
kind: Pod apiVersion: v1 metadata: name: fiopod spec: nodeSelector: acstor.azure.com/io-engine: acstor containers: - name: fio image: nixery.dev/shell/fio args: - sleep - "1000000" volumeMounts: - mountPath: "/volume" name: ephemeralvolume volumes: - name: ephemeralvolume ephemeral: volumeClaimTemplate: metadata: labels: type: my-ephemeral-volume spec: accessModes: [ "ReadWriteOnce" ] storageClassName: acstor-ephemeraldisk-nvme # replace with the name of your storage class if different resources: requests: storage: 1GiIf you change the storage size of the volume, make sure the size is less than the available capacity of a single node's ephemeral disk. Run
kubectl get diskpool -n acstorto check the available capacity.Pas het YAML-manifestbestand toe om de pod te implementeren.
kubectl apply -f acstor-pod.yamlU zou een uitvoer moeten zien die lijkt op het volgende:
pod/fiopod createdControleer of de pod in werking is en of de tijdelijke volumeclaim succesvol aan de pod is gekoppeld.
kubectl describe pod fiopod kubectl describe pvc fiopod-ephemeralvolume
U hebt nu een pod geïmplementeerd die lokale NVMe als opslag gebruikt en u kunt deze gebruiken voor uw Kubernetes-workloads.
Verify the available capacity of ephemeral disks before provisioning additional volumes:
kubectl describe node <node-name>
To learn more about Azure Container Storage, including how to create persistent volumes, see What is Azure Container Storage?
De hulpbronnen opschonen
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 storage pool.
kubectl delete sp -n acstor <storage-pool-name>Delete the extension instance.
az aks update -n myAKSCluster -g myResourceGroup --disable-azure-container-storage all
Volgende stap
In this tutorial, you deployed Azure Container Storage on your AKS cluster. U hebt geleerd hoe u het volgende kunt doen:
- Enable Azure Container Storage on your AKS cluster.
- Choose a backing storage type and create a storage pool.
- Deploy a pod with a generic ephemeral volume.
In the next tutorial, you learn how to deploy an application to your cluster.
Azure Kubernetes Service