How to troubleshoot when PreReqs pods are entering a pending state and showing the error "failed to provision volume with StorageClass 'managed-premium' "?
ISSUE
How to troubleshoot PreReqs pods that are going into a pending state and showing the error "failed to provision volume with StorageClass 'managed-premium"?
RESOLUTION
- While running PreReqs for Automation Suite on AKS, PreReq pods are going into a pending state. While describing the pod, it gives the following error about the storage class.
~~~~~~~~~~~~~~~~~~
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal WaitForFirstConsumer 58m persistentvolume-controller waiting for first consumer to be created before binding
Warning ProvisioningFailed 38m (x14 over 58m) disk.csi.azure.com_csi-azuredisk-controller-b795c7d87-sxdhj_0ab9d8d2-3fa3-41f6-b77d-eb1a862786b9 failed to provision volume with StorageClass "managed-premium": rpc error: code = Internal desc = Retriable: false, RetryAfter: 0s, HTTPStatusCode: 403, RawError: {"error":{"code":"RequestDisallowedByPolicy","target":"pvc-a6df3010-0dba-444d-bb28-4cc6df877a14","message":"Resource 'pvc-a6df3010-0dba-444d-bb28-4cc6df877a14' was disallowed by policy. Reasons: 'Only Standard SSD (StandardSSD_LRS) and Standard HDD (Standard_LRS) disks are allowed. If you need an exemption from this policy please contact CloudOps'. See error details for policy resource IDs.","additionalInfo":[{"type":"PolicyViolation","info":{"evaluationDetails":{"evaluatedExpressions":[{"result":"True","expressionKind":"Field","expression":"type","path":"type","expressionValue":"Microsoft.Compute/disks","targetValue":"Microsoft.Compute/disks","operator":"Equals"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Compute/disks/Sku.Name","path":"sku.name","expressionValue":"Premium_LRS","targetValue":"True","operator":"Exists"},{"result":"True","expressionKind":"Field","expression":"Microsoft.Compute/disks/Sku.Name","path":"sku.name","expressionValue":"Premium_LRS","targetValue":["StandardSSD_LRS","Standard_LRS"],"operator":"NotIn"}],"reason":"Only Standard SSD (StandardSSD_LRS) and Standard HDD (Standard_LRS) disks are allowed. If you need an exemption from this policy please contact CloudOps"},"policyDefinitionId":"/providers/Microsoft.Management/managementGroups/POC-EA-mgmt/providers/Microsoft.Authorization/policyDefinitions/5f78bad4-59ea-493b-b04d-3f574955438d","policyDefinitionName":"5f78bad4-59ea-493b-b04d-3f574955438d","policyDefinitionDisplayName":"UiPath Custom Policy - Enforce the use of Standard SSD or Standard HDD disks","policyDefinitionEffect":"deny","policyAssignmentId":"/providers/Microsoft.Management/managementGroups/POC-EA-mgmt/providers/Microsoft.Authorization/policyAssignments/d8003605397a447a959b9d36","policyAssignmentName":"d8003605397a447a959b9d36","policyAssignmentDisplayName":"UiPath Custom Policy - Enforce the use of Standard SSD or Standard HDD disks on PoC-EA","policyAssignmentScope":"/providers/Microsoft.Management/managementGroups/POC-EA-mgmt","policyAssignmentParameters":{"listOfSKUSize":["StandardSSD_LRS","Standard_LRS"]},"policyExemptionIds":[]}}]}}
Normal Provisioning 8m30s (x22 over 58m) disk.csi.azure.com_csi-azuredisk-controller-b795c7d87-sxdhj_0ab9d8d2-3fa3-41f6-b77d-eb1a862786b9 External provisioner is provisioning volume for claim "prereqfjttg/sc-check-pvc-storage-class-check-rqngm-0"
Normal ExternalProvisioning 3m20s (x222 over 58m) persistentvolume-controller waiting for a volume to be created, either by external provisioner "disk.csi.azure.com" or manually created by system administrator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- As the error also indicates, "Resource was disallowed by policy. Reason" this storage class is restricted by your organization due to expensive pricing
- Review the input.json file for the parameter "storage class." A value like the following might be present: "storage_class": "managed-premium."
- Another value for the storage class, "managed-csi," could be considered, as it is more cost-effective and may be permissible within your organization
- Update the storage class from "managed-premium" to "managed-csi"
- Re-run the PreReq, and it should pass for the storage class