Create PersistentVolume using diskName and diskURI

9/25/2018

In Kubernetes (Azure AKS), how do I create a PersistentVolume resource that is bound to my own managed disk Azure resource that has a specific diskName and diskURI (resource id)?

Here is one example but for a Pod:

kind: Pod
apiVersion: v1
metadata:
  name: mypodrestored
spec:
  containers:
    - name: myfrontendrestored
      image: nginx
      volumeMounts:
      - mountPath: "/mnt/azure"
        name: volume
  volumes:
    - name: volume
      azureDisk:
        kind: Managed
        diskName: pvcRestored
        diskURI: /subscriptions/<guid>/resourceGroups/MC_myResourceGroupAKS_myAKSCluster_eastus/providers/Microsoft.Compute/disks/pvcRestored
-- PussInBoots
azure
kubernetes

1 Answer

9/26/2018

You can create your own managed disk in the AKS cluster and then attach it to the pod which you need. For more details about the steps, see Volumes with Azure disks.

The result will like this:

enter image description here

-- Charles Xu
Source: StackOverflow