Hardening the AKS control plane: the basics
What does a soft Kubernetes control plane actually look like?
A Kubernetes cluster has two halves, and the control plane is the one that matters most for exposure. The API server is the single door through which every deployment, every kubectl command and every operator reaches the cluster, and by default on a public AKS cluster that door answers on a public endpoint that the whole internet can reach. Authentication still stands in front of it, but an internet-reachable API server is constant attack surface: it is probed, it is the target when a credential leaks, and it is the first thing an audit asks about. Defender for Cloud raises 'Kubernetes API server should be configured with restricted access' for exactly this, and the fix is to restrict that endpoint to known networks with authorised IP ranges or to make the cluster private.
The second half of the capability is whether the cluster can be governed at all. Azure Policy for Kubernetes installs an add-on on AKS (or an extension on Azure Arc-enabled clusters) that runs Gatekeeper, the Open Policy Agent admission controller, inside the cluster. Without it, the data-plane guardrails (no privileged containers, no host network, read-only root filesystems, approved registries) cannot be evaluated or enforced, so Defender raises 'Azure Kubernetes Service clusters should have the Azure Policy add-on for Kubernetes installed' and, for Arc clusters, 'Azure Arc-enabled Kubernetes clusters should have the Azure Policy extension installed'. The add-on is the enforcement engine the rest of your Kubernetes policy depends on.
The third leg is the host underneath. Where you run containers on plain Linux VMs rather than managed AKS nodes, Defender for Servers compares each Docker host against the CIS Docker Benchmark and raises 'Container hosts should be configured securely' when the daemon or the host configuration drifts from that baseline. These read as separate findings, but they are one job: shut the front door to known networks, install the engine that enforces guardrails inside the cluster, and keep the hosts beneath your containers configured to a baseline.
In this lesson you will learn how an AKS control plane is exposed, how to find every cluster whose API server is open to the internet or missing the policy engine, and how to lock them down without cutting off the pipelines and operators that legitimately need to reach the cluster. The Controls this lesson covers section lists every Defender for Cloud recommendation in this capability, each linking to a deep page with the exact check and a copy-and-paste fix.
The dashboard that mined the coins
Some of the earliest large-scale Kubernetes compromises did not start with a clever exploit at all. They started with a control plane or dashboard left reachable from the internet with no access restriction, found by an automated scanner, and quietly turned into a cryptomining farm running on someone else's bill. The Tesla cloud cryptojacking incident in 2018 was exactly this shape: an exposed Kubernetes console with no password. The lesson stuck. Restricting who can even reach the API server, and installing a policy engine that refuses privileged or unapproved workloads, closes the door those campaigns walked through.
Finding control-plane exposure across a subscription
Sam is the platform lead at a scale-up preparing for its first SOC 2 audit. Defender for Cloud shows Kubernetes findings spread across several AKS clusters in two subscriptions that pre-date the team's current guardrails.
Rather than work the findings one by one, Sam starts by listing which clusters still expose the API server to the whole internet and which are missing the Azure Policy add-on, so the production clusters can be separated from throwaway dev ones before anything changes.
List every AKS cluster, showing whether authorised IP ranges are set on the API server and whether the Azure Policy add-on is enabled.
An empty AuthIPs column means the API server answers the whole internet; a False Policy column means no guardrails are enforced inside the cluster. A production cluster with both is the highest-value target in this group.
How Defender for Cloud decides a control plane is exposeddeep dive
The API server finding resolves to the cluster's API server access profile. On a public AKS cluster, when 'authorizedIpRanges' is empty the public endpoint accepts connections from any address, and Defender raises 'Kubernetes API server should be configured with restricted access'. There are two clean ways to clear it: set authorised IP ranges so only your known networks (office egress, CI runners, a jumpbox) can reach the endpoint, or create the cluster as a private cluster so the API server is exposed only on a private endpoint inside your virtual network. Both map to the Microsoft Cloud Security Benchmark control for securing cloud services with network controls.
The policy-engine findings resolve to whether the add-on or extension is installed. The AKS recommendation checks 'addonProfiles.azurepolicy.enabled' on the cluster; the Arc recommendation checks for the 'Microsoft.PolicyInsights' cluster extension on the connected cluster. The add-on deploys Gatekeeper, the Open Policy Agent admission controller, which is what actually evaluates the data-plane policies (no privileged containers, approved registries, read-only root filesystems) against incoming workloads. Without it those policies have nowhere to run, which is why this control underpins the whole Kubernetes data-plane group.
The host finding sits in a different plane entirely. 'Container hosts should be configured securely' is a Defender for Servers recommendation that compares Linux machines running Docker against the CIS Docker Benchmark. It applies to Docker on your own virtual machines, not to AKS-managed nodes, where Microsoft operates and hardens the node image for you. Defender for Cloud evaluates all of these against the benchmark on a periodic cycle, so a fix does not flip the recommendation to Healthy instantly: the control-plane change is immediate, but the posture catches up on the next assessment, which matters when you are gathering audit evidence against a deadline.
What is the impact of leaving the control plane exposed?
The direct impact is a foothold on the most powerful surface you operate. An internet-reachable API server is probed continuously and is the target the moment a kubeconfig, service-account token or CI credential leaks. Once an attacker can talk to the control plane, the blast radius is the whole cluster: every secret it holds, every workload it schedules, and the cloud identities those workloads carry. The earliest mass Kubernetes incidents were not exotic exploits, they were open endpoints turned into cryptomining or data theft.
The second-order impact is that without the policy engine, the guardrails everyone assumes are enforced are not. A cluster with no Azure Policy add-on will happily schedule a privileged container, a pod on the host network, or an image from an unknown registry, because nothing is standing at admission to refuse it. Installing the engine shrinks the runtime to the workloads you actually allow, which are the ones you can reason about and defend.
On the compliance side, every modern framework, ISO 27001, SOC 2, the CIS Kubernetes and Azure benchmarks, PCI DSS and the UK and EU data-protection regimes, expects evidence that administrative interfaces are not openly reachable and that workload controls are enforced. A passing set of Kubernetes recommendations across every cluster is the cheapest and most defensible artefact you can hand an auditor.
How do you lock the control plane down safely?
Work the capability as one loop rather than chasing individual findings. The order matters: know which networks legitimately need to reach each API server before you start restricting it, so you do not lock your own pipelines out of the cluster.
1. Inventory every cluster by exposure
List every AKS and Arc-connected cluster, showing whether the API server has authorised IP ranges (or is private) and whether the Azure Policy add-on or extension is installed. Treat this inventory as the source of truth, not the Defender finding count, because one cluster can trigger several recommendations at once.
2. Decide restricted-IP versus fully private per cluster
For each cluster, decide the right end state. Authorised IP ranges keep the public endpoint but limit it to your office egress, CI runners and any jumpbox, and are a one-command change. A fully private cluster removes the public endpoint entirely but means pipelines and operators need a path into the virtual network, so plan that networking change before you flip it. Production and customer-facing clusters justify the stronger option.
3. Install the policy engine on every cluster
Register the Microsoft.PolicyInsights provider, then enable the Azure Policy add-on on each AKS cluster and the equivalent Microsoft.PolicyInsights extension on each Arc-connected cluster. This deploys Gatekeeper so the data-plane guardrails (no privileged containers, approved registries, read-only root filesystems) can actually be evaluated and enforced. Start the assigned policies in audit, then move the ones you trust to deny.
4. Ratchet it shut with Azure Policy, and baseline the hosts
Assign the built-in audit policies so any new cluster missing authorised IP ranges or the policy add-on is flagged automatically, and bring any self-managed Docker hosts up to the CIS Docker Benchmark that 'Container hosts should be configured securely' checks. The backstop is what turns a one-off cleanup into a guarantee that the next cluster is built safely.
RG=prod-rg
CLUSTER=prod-payments
SUB=$(az account show --query id -o tsv)
# 1. Restrict the API server to known networks (office egress + CI runners).
# Use a private cluster instead where the public endpoint is not needed.
az aks update --resource-group "$RG" --name "$CLUSTER" \
--api-server-authorized-ip-ranges "203.0.113.0/24,198.51.100.10/32"
# 2. Install the policy engine so guardrails are actually enforced in-cluster.
az provider register --namespace Microsoft.PolicyInsights
az aks enable-addons --resource-group "$RG" --name "$CLUSTER" --addons azure-policy
# For an Azure Arc-connected cluster, install the extension instead of the add-on:
# az k8s-extension create --name azurepolicy --extension-type Microsoft.PolicyInsights \
# --cluster-type connectedClusters --cluster-name <arc-cluster> --resource-group "$RG"
# 3. Ratchet it shut: audit any future cluster missing the policy add-on.
# Look the built-in policy up by its EXACT display name (never hardcode the GUID).
pid=$(az policy definition list \
--query "[?displayName=='Azure Policy Add-on for Kubernetes service (AKS) should be installed and enabled on your clusters'].name" -o tsv)
az policy assignment create --name audit-aks-policy-addon \
--policy "$pid" --scope "/subscriptions/$SUB" Quick quiz
Question 1 of 5Defender for Cloud shows Kubernetes findings across API server access and a missing Azure Policy add-on on several clusters. What is the most efficient way to think about them?
You scored
0 / 5
Keep learning
Go deeper on how an AKS control plane expresses reachability and governance across the settings in this capability.
- Secure access to the API server using authorized IP address ranges in AKS How to restrict the public API server endpoint to known networks, including the Standard Load Balancer requirement.
- Create a private Azure Kubernetes Service cluster How to remove the public API server endpoint entirely and reach the cluster over a private endpoint.
- Use Azure Policy to secure your AKS clusters How the Azure Policy add-on installs Gatekeeper and enforces built-in workload policies.
You can now treat the AKS control plane as one capability rather than a scatter of findings: inventory which clusters are reachable too widely or missing the policy engine, decide restricted-IP versus private per cluster, install Azure Policy so guardrails are enforced inside every cluster, and ratchet the estate shut with an audit policy plus a CIS baseline on any self-managed hosts. The Controls this lesson covers section below links every recommendation in this group to its deep page and fix.
Back to the library