Configure Azure NetApp NFS file volumes for Azure Kubernetes Service - Azure Kubernetes Service (2023)

  • article

After youConfigure Azure NetApp Files for Azure Kubernetes Service, you can configure Azure NetApp Archive volumes for Azure Kubernetes Service.

Azure NetApp Files supports NFS (NFSv3 or NFSv4.1) based volumes,media, thisdouble agreement(NFSv3 and SMB, or NFSv4.1 and SMB).

  • This article describes the details of configuring NFS volumes statically or dynamically.
  • For information on configuring SMB volumes statically or dynamically , seeConfigure Azure NetApp Files SMB volumes for Azure Kubernetes Service.
  • For information on statically configuring dual-protocol volumes , seeConfigure Azure NetApp Dual Protocol Volume Files for Azure Kubernetes Service

Static configuration for applications using NFS volumes

This section describes how to create an NFS volume in Azure NetApp Archive and statically expose the volume to Kubernetes. It also describes how to use volumes with containerized applications.

Create NFS volumes

  1. Set variables for future use. replacemy resource group,my position,my account name,However 1,High quality,my file path,size,mivolname,vnetid, ysubnet IDAt a price that suits your account and environment. hefile pathMust be unique across all ANF accounts.

    RESOURCE_GROUP="myresourcegroup"LOCATION="myubication"ANF_ACCOUNT_NAME="myaccountname"POOL_NAME="mypool1"SERVICE_LEVEL="premium" # Los valores válidos son Standard, Premium y UltraUNIQUE_FILE_PATHNAME"VME_IBOLize"VUME_IBOL"my ="myvolname"VNET_ID ="vnetId" SUBNET_ID="anfSubnetId"
  2. Create a volume using itaz netappfiles volumen creardepartment. For more information, seeCreate NFS volumes for NetApp Azure Files.

    az netappfiles volumen crear \ --group-resource $RESOURCE_GROUP \ --location $LOCATION \ --account-name $ANF_ACCOUNT_NAME \ --pool-name $POOL_NAME \ --name "$VOLUME_NAME" \ --service-level $SERVICE_LEVEL \ --vnet $VNET_ID \ --subnet $SUBNET_ID \ --usage limit $VOLUME_SIZE_GIB \ --filepath $UNIQUE_FILE_PATH \ --protocol types NFSv3

create persistent volume

  1. Enter your volume details usingvolume show az netappfilesdepartment. If not set in the previous step, replace the variable with the appropriate value for your Azure NetApp Files account and environment.

    az netappfiles volumen show \ --resource-group $RESOURCE_GROUP \ --account-name $ANF_ACCOUNT_NAME \ --pool-name $POOL_NAME \ --volume-name "$VOLUME_NAME -o JSON

    The following output is an example of the above command run with actual values.

    { ... "creationToken": "myfilepath2", ... "mountTargets": [ { ... "ipAddress": "", ... } ], ...}
  2. Create a file namedpv-nfs.yamland copy the following YAML. Make sure the server matches the output IP address from step 1 and the route matches its outputcreate tokenExceed. The capacity should also match the volume size from the previous step.

    apiVersion: v1kind: PersistentVolumemetadata: Name: pv-nfsspec: Capacity: Storage: 100Gi Access Mode: -ReadWriteMany mountOptions: -vers=3 nfs: Server: Path: /myfilepath2
  3. Create a persistent volume usingapply kubectldepartment:

    kubectl apply -f pv-nfs.yaml
  4. Make sure the persistent volume status isusableuse itkubectl descriptiondepartment:

    kubectl describe pv pv-nfs

Create a persistent volume claim

  1. Create a file namedpvc-nfs.yamland copy the following YAML. This manifest creates a file namedPVC-NFSfor 100Gi storage andLeer Escribir Muchos ReadThe access mode, which matches the PV you created.

    apiVersion:v1kind:PersistentVolumeClaimmetadata:Name:pvc-nfsspec:accessModes:-ReadWriteMany storageClassName: "" Resource:Request:Storage:100Gi
  2. useapply kubectldepartment:

    kubectl apply -f pvc-nfs.yaml
  3. verifysituationThe persistent volume claim istied upuse itkubectl descriptiondepartment:

    kubectl describe pvc pvc-nfs

walk with a suitcase

  1. Create a file namednginx-nfs.yamland copy the following YAML. This declaration defines anginxPods restored using persistent volumes.

    Type: PodapiVersion: v1 Metadata: Name: nginx-nfsspec: Container: - Image: Name: nginx-nfs Command: - "/bin/sh" - "-c" - as long as it is true. do echo $(date) >> /mnt/azure/outfile; sleep 1; done volumeMounts: - Name: disk01 mountPath: /mnt/azure volumes: - Name: disk01 persistentVolumeClaim: ClaimName: pvc-nfs
  2. Use it to create podsapply kubectldepartment:

    kubectl apply -f nginx-nfs.yaml
  3. Check the capsules forrunninguse itkubectl descriptiondepartment:

    kubectl describe nginx-nfs pod
  4. Make sure your volume is mounted in the pod usingkubectl executeConnect to the pod and then usedf-hCheck if the volume is set.

    kubectl exec -it nginx-nfs --sh
    / # df -hUsed filesystem size % Usage Available Mounted on... 100T 384K 100T 1% /mnt/azure...

Dynamic configuration of applications using NFS volumes

Astra Trident can be used to dynamically provision NFS or SMB files to Azure NetApp Files. Dynamically provisioned SMB volumes are only supported on Windows worker nodes.

This section describes how to use Astra Trident to dynamically create and automatically mount NFS volumes in NetApp Azure Files to containerized applications.

Install Astra Trident

To configure NFS volumes dynamically, you must have Astra Trident installed. Astra Trident is NetApp's stack provider designed specifically for Kubernetes. Simplify storage consumption for Kubernetes applications using Astra Trident industry standardContainer Storage Interface (CSI)guide. Astra Trident is deployed as a Pod on a Kubernetes cluster and provides heap orchestration services for Kubernetes workloads.

Trident can be installed using the Trident Operator (manually or usingrudder) thistrident.For more information on these installation methods and how they work, see theAstra Trident Installation Guide.

Install Astra Trident using Helm

rudderIt must be installed on your workstation to install Astra Trident using this method. For other Astra Trident installation methods, seeAstra Trident Installation Guide.

  1. To install Astra Trident using Helm for a cluster containing only Linux worker nodes, run the following command:

    helm repo agregue netapp-trident helm 安装 trident netapp-trident/trident-operator --έκδοση 23.04.0 --create-namespace --namespace trident

    The output of the command is similar to the following example:

    Name: trident Last Developed: Fri May 05 13:55:36 2023 Namespace: trident Status: Deployed Revision: 1 Test Suite: None Note: Thanks for installing trident-operator, which will deploy and manage CSI Kubernetes The NetApp provider of Trident. Its version is called "triaina" and is installed in the "triaina" namespace. Note that there should only be one Trident instance (and trident operator) in a Kubernetes cluster. To configure Trident to manage storage resources, you need a copy of tridentctl, which is available in prepackaged versions of Trident. All releases and source code for Trident can be found online at For more traffic information try: $ rudder status trident $ rudder get all tridents
  2. To confirm that Astra Trident has been installed successfully, do the followingkubectl descriptiondepartment:

    kubectl describe torc trident

    The output of the command is similar to the following example:

    Name: tridentNamespace: Label: trident tridentAPI Version: TridentOrchestratorMetadata: ... specs: IPv6: false autosupport image: autosupport server:Disable audit logging: true Enable force logout: false Http request timeout: 90 seconds Image pull policy: IfNotPresent k8sTimeout: 0 Kubelet director:Record Format: Text Record Level:Registration workflow:Namespace: trident Probe Port: 17546 Silence Auto Support: false Trident Image: Windows: falseStatus: Current Installation Parameters: IPv6: false Auto Support Hostname: Image Auto Support: netapp/trident-autosupport:23.04 Auto Proxy Support: Auto Support Serial Number: Debug: False Disable Audit Logging: True Enable Force Disconnect: False Http Request Timeout: 90 Pull Policy Image Extract Secrets: IfNotPresent Image Extract Secrets: Image Log :k8sTimeout: Directed: /var/lib/kubelet Log Format: Text Log Level: Log Level: Info Logging Workflow: Probe Port: 17546 Silent AutoSupport: false Trident Image: 23.04.0 Message: Installed Trident namespace: trident state: installed version: v23.04.0 event: type reason message age ---- --- --- ---- - --- ------ - normal install 2m59s trident Install Trident Normal install 2 min 31 sec Install Trident

Create the back

In order to tell Astra Trident about the Azure NetApp Files subscription and where it needs to create volumes, a backend is created. This step requires details about the account created in the previous step.

  1. Create a file namedbackend-secret.yamland copy the following YAML. Changecustomer identificationyesclient secretAt a price that fits your environment.

    apiVersion: v1kind: Secretmetadata: nombre: backend-tbc-anf-secrettype: OpaquestringData: clientID: abcde356-bf8e-fake-c111-abcde35613aa clientSecret: rR0rUmWXfNioGiNSAKht
  2. Create a file namedbackend anf.yamland copy the following YAML. Changesubscription number,quinoline,Place, yService LevelAt a price that fits your environment. use itsubscription numberFor Azure subscriptions with Azure NetApp Files enabled. takequinoline,customer identification, yclient secretFrom aApplication documentSufficient permissions to Azure NetApp Files in Azure Active Directory (AD). Application registration includes the Azure predefined Owner or Partner roles. The site must be an Azure site with at least one authorized subnet created in the previous step. heService Levelmust matchService LevelFor the capacity group set toConfigure Azure NetApp Files for AKS workloads.

    apiVersion: TridentBackendConfig metadata: name: backend-tbc-anfspec: version: 1 storageDriverName: azure-netapp-files id. Subscription ID: 12abc678-4774-fake-a1b2-a7abcde39312 Tenant: a7abcde3-edc1-fake-b111-a7abcde356cf Location: eastus Service Level: Advanced Credentials: Name: backend-tbc-anf-secret

    For more information on backends, seeAzure NetApp Files backend configuration options and examples.

  3. Use it to implement secrets and backendsapply kubectldepartment. First apply the secret:

    kubectl apply -f backend-secret.yaml -n trident

    The output of the command is similar to the following example:

    secrets/backend-tbc-anf-secret creado

    Implement the backend:

    kubectl apply -f backend-anf.yaml -n trident

    The output of the command is similar to the following example:

  4. Confirm that the backend is usingkubectl I seedepartment:

    kubectl obtener tridentbackends -n trident

    The output of the command is similar to the following example:

    name backend backend UUIDtbe-kfrdh backend-tbc-anf 8da4e926-9dd4-4a40-8d6a-375aab28c566

Create a storage class

Storage classes are used to define how persistent volume storage units are dynamically created. To use volumes in Azure NetApp Files, a storage class must be created.

  1. Create a file namedanf-storage-class.yamland copy the following YAML:“azure-netapp-files”fsType:“nfs”
  2. Create a storage class usingapply kubectldepartment:

    kubectl apply -f anf-storageclass.yaml

    The output of the command is similar to the following example:

    Created the azure-netapp/storage-class file
  3. runkubectl I seeCommand to view storage class status:


Create PVCs

A Persistent Volume Claim (PVC) is a user request for storage. By creating a persistent volume claim, Astra Trident automatically creates an Azure NetApp Files volume and makes it available to Kubernetes workloads.

  1. Create a file namedanf-pvc.yamland copy the following YAML. In this example, a 1 TiB volume with ReadWriteMany access is required.

    Type: PersistentVolumeClaimapiVersion: v1metadata: Name: anf-pvcspec: accessModes: -ReadWriteMany Resource: Request: Storage: 1Ti storageClassName: azure-netapp-files
  2. Create a persistent volume claim using the following commandapply kubectldepartment:

    kubectl apply -f anf-pvc.yaml

    The output of the command is similar to the following example:

    persistentevolumeclaim/anf-pvc creado
  3. To view information about persistent volume recovery, run thiskubectl I seedepartment:

    kubectl get pvc

    The output of the command is similar to the following example:

    kubectl get pvc -n tridentNAME STATUS VOLUME CAPACITY ACCESS STORAGE MODES CLASS AGedanf-pvc Connected pvc-bffa315d-3f44-4770-86eb-c922f567a075 1Ti RWOapp-azure-6net

use persistent volume

After the PVC is created, Astra Trident creates the Persistent Volume. A pod can be started to mount and access an Azure NetApp Files volume.

The following manifest can be used to define the NGINX group that mounts the Azure NetApp Files volume created in the previous step. In this example, the volume is attached/mnt/data.

  1. Create a file namedanf-nginx-pod.yamland copy the following YAML:

    Type: PodapiVersion: v1 Metadata: Name: nginx-podspec: Container: -name: nginx Image: Source: Request: cpu: 100m Memory: 128Mi limit : cpu: 250m memory: 256MyVolumeMounts: - mount path: "/mnt/data" name: volume volumes: - name: persistent volumeVolumeClaim: ClaimName: anf-pvc
  2. Use it to create podsapply kubectldepartment:

    kubectl apply -f anf-nginx-pod.yaml

    The output of the command is similar to the following example:

    pod/nginx-pod create

    Kubernetes creates a pod with a volume mounted and accessible in itnginxinside the container/mnt/data.You can confirm this by viewing the pod event log withkubectl descriptiondepartment:

    kubectl describe nginx-pod pod

    The output of the command is similar to the following example:

    [...] Volumes: volume: Type: PersistentVolumeClaim (references a PersistentVolumeClaim in the same namespace) ClaimName: anf-pvc ReadOnly: false default-token-k7952: Type: Secret (volume populated by a secret) SecretName: default-token -k7952 Optional: false[...] Events: Type Cause Age From Message ---- ------- ---- ---- ------- Normal Scheduled 15 sec. Default - Development Person successfully attached trident/nginx-pod to Brameshb-non-Root-Test Normal Successattachvolume 15s Attachdetach-Controller Attachvolume.attach successfully for volume "PVC-BFFA315D-3F44-4770-C6720c /nginx:1.15.5-alpine" already exists on machine Normal Created 11s kubelet Created nginx container Normal Started 10s kubelet Container started nginx

Next step

Astra Trident supports many features of NetApp Azure Files. For more information, see:


Top Articles
Latest Posts
Article information

Author: Dan Stracke

Last Updated: 07/09/2023

Views: 6036

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Dan Stracke

Birthday: 1992-08-25

Address: 2253 Brown Springs, East Alla, OH 38634-0309

Phone: +398735162064

Job: Investor Government Associate

Hobby: Shopping, LARPing, Scrapbooking, Surfing, Slacklining, Dance, Glassblowing

Introduction: My name is Dan Stracke, I am a homely, gleaming, glamorous, inquisitive, homely, gorgeous, light person who loves writing and wants to share my knowledge and understanding with you.