Bylaw

Gallery › Kubernetes › Azure Community Policy

Control allowed Proc Mount Type on pods in a Kubernetes Cluster

Doesn't convert yet Policy Audit Deny Disabled Mode Microsoft.Kubernetes.Data Version 1.0.0 Preview

This policy controls valid ProcMount types on pods in a Kubernetes cluster. For instructions on using this policy, please visit https://aka.ms/kubepolicydoc.

ConvertTo-Bylaw can't convert this policy yet:

Azure Policy JSONazurepolicy.json · 75 lines
{
  "properties": {
    "displayName": "Control allowed Proc Mount Type on pods in a Kubernetes Cluster",
    "policyType": "Custom",
    "mode": "Microsoft.Kubernetes.Data",
    "description": "This policy controls valid ProcMount types on pods in a Kubernetes cluster. For instructions on using this policy, please visit https://aka.ms/kubepolicydoc.",
    "metadata": {
      "version": "1.0.0",
      "category": "Kubernetes",
      "preview": true
    },
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of 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. Providing a value for this parameter is optional."
        },
        "defaultValue": [
          "kube-system",
          "gatekeeper-system",
          "azure-arc"
        ]
      },
      "procMountType": {
        "type": "String",
        "metadata": {
          "displayName": "Type of Proc Mount for containers to use.",
          "description": "The type of proc mount to use for containers to use in the cluster. Either 'Default' or 'Unmasked'."
        },
        "allowedValues": [
          "Unmasked",
          "Default"
        ],
        "defaultValue": "Default"
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "in": [
          "AKS Engine",
          "Microsoft.Kubernetes/connectedClusters",
          "Microsoft.ContainerService/managedClusters"
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "constraintTemplate": "https://raw.githubusercontent.com/Azure/Community-Policy/master/policyDefinitions/Kubernetes/allowed-proc-mount-types/template.yaml",
          "constraint": "https://raw.githubusercontent.com/Azure/Community-Policy/master/policyDefinitions/Kubernetes/allowed-proc-mount-types/constraint.yaml",
          "values": {
            "excludedNamespaces": "[parameters('excludedNamespaces')]",
            "procMountType": "[parameters('procMountType')]"
          }
        }
      }
    }
  },
  "type": "Microsoft.Authorization/policyDefinitions",
  "name": "6ca88de2-34f1-4136-8438-76c000222a09"
}

Source: policyDefinitions/Kubernetes/allowed-proc-mount-types/azurepolicy.json in Azure/Community-Policy, under the MIT licence.