Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article describes how to configure Local Shared Edge Volumes (highly available, durable local storage) in Azure Container Storage enabled by Azure Arc.
Create a Local Shared Edge Volumes Persistent Volume Claim (PVC) and configure a pod against the PVC
Create a file named
localSharedPVC.yamlwith the following contents. Modify themetadata.namevalue with a name for your Persistent Volume Claim. Then, in line 8, specify the namespace that matches your intended consuming pod. Themetadata.namevalue is referenced on the last line ofdeploymentExample.yamlin the next step. Thespec.resources.requests.storageparameter determines the size of the persistent volume. It's 2 GB in this example, but can be modified to fit your needs:Note
Use only lowercase letters and dashes. For more information, see the Kubernetes object naming documentation.
kind: PersistentVolumeClaim apiVersion: v1 metadata: ### Create a name for your PVC ### name: <create-a-pvc-name-here> ### Use a namespace that matches your intended consuming pod, or "default" ### namespace: <intended-consuming-pod-or-default-here> spec: accessModes: - ReadWriteMany resources: requests: storage: 2Gi storageClassName: unbacked-scCreate a file named
deploymentExample.yamlwith the following contents. Add values forcontainers.nameandvolumes.persistentVolumeClaim.claimName. Thespec.replicasparameter determines the number of replica pods to create. It's 2 in this example, but can be modified to fit your needs:Note
Use only lowercase letters and dashes. For more information, see the Kubernetes object naming documentation.
apiVersion: apps/v1 kind: Deployment metadata: name: localsharededgevol-deployment ### This will need to be unique for every volume you choose to create spec: replicas: 2 selector: matchLabels: name: wyvern-testclientdeployment template: metadata: name: wyvern-testclientdeployment labels: name: wyvern-testclientdeployment spec: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app operator: In values: - wyvern-testclientdeployment topologyKey: kubernetes.io/hostname containers: ### Specify the container in which to launch the busy box. ### - name: <create-a-container-name-here> image: 'mcr.microsoft.com/mirror/docker/library/busybox:1.35' command: - "/bin/sh" - "-c" - "dd if=/dev/urandom of=/data/acsalocalsharedtestfile count=16 bs=1M && while true; do ls /data &>/dev/null || break; sleep 1; done" volumeMounts: ### This name must match the following volumes::name attribute ### - name: wyvern-volume ### This mountPath is where the PVC will be attached to the pod's filesystem ### mountPath: /data volumes: ### User-defined name that is used to link the volumeMounts. This name must match volumeMounts::name as previously specified. ### - name: wyvern-volume persistentVolumeClaim: ### This claimName must refer to your PVC metadata::name from lsevPVC.yaml. claimName: <your-pvc-metadata-name-from-line-5-of-pvc-yaml>To apply these YAML files, run:
kubectl apply -f "localSharedPVC.yaml" kubectl apply -f "deploymentExample.yaml"Run
kubectl get podsto find the name of your pod. Copy this name, so you can use it in the next step.Note
Because
spec::replicasfromdeploymentExample.yamlwas specified as2, two pods appear usingkubectl get pods. You can choose either pod name to use for the next step.Run the following command and replace
POD_NAME_HEREwith your copied value from the previous step:kubectl exec -it pod_name_here -- shChange directories to the
/datamount path, as specified indeploymentExample.yaml.As an example, create a file named
file1.txtand write to it usingecho "Hello World" > file1.txt.
After you complete the previous steps, begin monitoring your deployment using Azure Monitor and Kubernetes Monitoring, or other monitoring tools such as Prometheus or Grafana.