Azure Managed Disk with Custom Resource Group
What happened:
We have created a custom storage class so that we can store our disks in a different resource group than the MC_XXX resource group created by AKS. Our storage class definition looks like:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
annotations:
volume.beta.kubernetes.io/resource-group: cluster-data-group
labels:
app.kubernetes.io/instance: storageclasses
app.kubernetes.io/managed-by: Tiller
app.kubernetes.io/name: storageclasses
helm.sh/chart: storageclasses-2019.1.11
name: managed-premium-expandable
parameters:
kind: Managed
storageaccounttype: Premium_LRS
provisioner: kubernetes.io/azure-disk
reclaimPolicy: Delete
volumeBindingMode: Immediate
allowVolumeExpansion: true
What you expected to happen:
We expected the disks created from PVCs to be placed in a resource group called cluster-data-group.
Instead, the disks were created in the MC_ resource group.
How to reproduce it (as minimally and precisely as possible):
- Create the storage class as specified above.
- Create a PVC using that storage class.
Anything else we need to know?:
Environment:
-
Kubernetes version (use
kubectl version): Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"windows/amd64"} Server Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.5", GitCommit:"753b2dbc622f5cc417845f0ff8a77f539a4213ea", GitTreeState:"clean", BuildDate:"2018-11-26T14:31:35Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"} -
Size of cluster (how many worker nodes are in the cluster?) 8 x Standard_D2s_v3
-
General description of workloads in the cluster (e.g. HTTP microservices, Java app, Ruby on Rails, machine learning, etc.) Prometheus monitoring stack, ES + Fluent D, TeamCity.
-
Others: As far as we can tell, it looks like the change to support this should have been merged into 1.11 as part of https://github.com/kubernetes/kubernetes/pull/64427. It doesn't look like there's any documentation for this change though, so it's pretty unclear if it's meant to be used / if it works.
would you try add resourcegroup: cluster-data-group into the storage class, this feature should be in v1.11.x now. And pls make sure your service principal could access that resource group:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: hdd
provisioner: kubernetes.io/azure-disk
parameters:
...
resourcegroup: cluster-data-group
Hey @andyzhangx, I checked your recommendation and as expected the storage resources are created in a separate resource group!
External resource group support for azure disk PV dynamic provisioning
all resource groups should be in same subscription, we don’t support cross-subscription scenario
example: https://github.com/andyzhangx/demo/blob/master/pv/storageclass-azuredisk-external-rg.yaml
details: fix azure disk creation issue when specifying external resource group
| k8s version | fixed version |
|---|---|
| v1.7 | not supported |
| v1.8 | 1.8.15 |
| v1.9 | 1.9.11 |
| v1.10 | 1.10.6 |
| v1.11 | 1.11.0 |
I will close this issue, let me know if you have any question.
@andyzhangx sorry - only just noticed your reply. We'll give that a try. Thanks.