last sync: 2020-Oct-20 13:29:33 UTC

Azure Policy

Kubernetes cluster pod FlexVolume volumes should only use allowed drivers

Name Kubernetes cluster pod FlexVolume volumes should only use allowed drivers
Id f4a8fce0-2dd5-4c21-9a36-8f0ec809d663
Version 1.0.1
details on versioning
Category Kubernetes
Description This policy ensures pod FlexVolume volumes only use allowed drivers in a Kubernetes cluster. This policy is generally available for Kubernetes Service (AKS), and preview for AKS Engine and Azure Arc enabled Kubernetes. For instructions on using this policy, visit https://aka.ms/kubepolicydoc.
Mode Microsoft.Kubernetes.Data
Type BuiltIn
Preview FALSE
Deprecated FALSE
Effect Default: audit
Allowed: (audit,deny,disabled)
Used RBAC Role none
History
Date/Time (UTC ymd) (i) Change type Change detail
2020-09-15 14:06:41 change Previous DisplayName: [Preview]: Kubernetes cluster pod FlexVolume volumes should only use allowed drivers
2020-07-08 14:28:08 add f4a8fce0-2dd5-4c21-9a36-8f0ec809d663
Used in Initiatives none
Json
{
  "properties": {
    "displayName": "Kubernetes cluster pod FlexVolume volumes should only use allowed drivers",
    "policyType": "BuiltIn",
    "mode": "Microsoft.Kubernetes.Data",
    "description": "This policy ensures pod FlexVolume volumes only use allowed drivers in a Kubernetes cluster. This policy is generally available for Kubernetes Service (AKS), and preview for AKS Engine and Azure Arc enabled Kubernetes. For instructions on using this policy, visit https://aka.ms/kubepolicydoc.",
    "metadata": {
      "version": "1.0.1",
      "category": "Kubernetes"
    },
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "'Audit' allows a non-compliant resource to be created or updated, but flags it as non-compliant. 'Deny' blocks the non-compliant resource creation or update. 'Disabled' turns off the policy."
        },
        "allowedValues": [
          "audit",
          "deny",
          "disabled"
        ],
        "defaultValue": "audit"
      },
      "excludedNamespaces": {
        "type": "Array",
        "metadata": {
          "displayName": "Namespace exclusions",
          "description": "List of Kubernetes namespaces to exclude from policy evaluation."
        },
        "defaultValue": [
          "kube-system",
          "gatekeeper-system",
          "azure-arc"
        ]
      },
      "allowedFlexVolumeDrivers": {
        "type": "Array",
        "metadata": {
          "displayName": "Allowed FlexVolume drivers",
          "description": "The list of drivers that FlexVolume volumes are allowed to use. Provide empty list as input to block everything."
        },
        "defaultValue": [
          
        ]
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "in": [
          "AKS Engine",
          "Microsoft.Kubernetes/connectedClusters",
          "Microsoft.ContainerService/managedClusters"
        ]
      },
      "then": {
      "effect": "[parameters('effect')]",
        "details": {
          "constraintTemplate": "https://raw.githubusercontent.com/Azure/azure-policy/master/built-in-references/Kubernetes/flexvolume-drivers/template.yaml",
          "constraint": "https://raw.githubusercontent.com/Azure/azure-policy/master/built-in-references/Kubernetes/flexvolume-drivers/constraint.yaml",
          "values": {
          "allowedFlexVolumeDrivers": "[parameters('allowedFlexVolumeDrivers')]",
          "excludedNamespaces": "[parameters('excludedNamespaces')]"
          }
        }
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/f4a8fce0-2dd5-4c21-9a36-8f0ec809d663",
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "f4a8fce0-2dd5-4c21-9a36-8f0ec809d663"
}