URL has been copied successfully!
URL has been copied successfully!
URL has been copied successfully!
Share:
Twitter
LinkedIn
Facebook
Reddit
Follow by Email
Copy link
Threads
Bluesky
Reading Time: 9 minutes

I picked this one up whilst checking the AKS Docs Tracker. A brand new Microsoft Learn page appeared covering private link for AKS extensions, and it's a really nice addition. It lets extension agents like Flux talk to Azure through a private endpoint in your virtual network, instead of heading out to a public IP address. If you've ever had to justify another public endpoint on a locked-down cluster's egress list, you'll see why this caught my eye.

That was enough for me to spin up a cluster with Flux and have a poke around. It mostly worked as advertised, but DNS caught me out along the way, and I'll show you how to avoid it. Everything below is the full path I followed, from an empty resource group to Flux running over a private endpoint.

Why private link for AKS extensions matters

Cluster extensions like Flux run an agent in your cluster that keeps checking in with Azure. It pulls pending configuration and posts status back to a regional data plane endpoint, <region>.dp.kubernetesconfiguration.azure.com. Until now that traffic left the cluster to a public address.

If you're running locked-down AKS clusters, that's one more public endpoint on your egress allow list. With private link for AKS extensions, you create a Private Link Scope for the cluster, put a private endpoint in your virtual network, and let DNS send the agent to a private IP. Once that works, you can turn off public network access on the scope.

What to know before you try it

The feature is in public preview, so the usual preview supplemental terms apply. These are the things I'd want to know before starting.

  • Everything stays in one region. The Private Link Scope and the private endpoint must be in the same region as the cluster, and the private DNS zone name includes the region too, <region>.privatelink.dp.kubernetesconfiguration.azure.com.
  • Each scope points at one cluster. It's a Microsoft.KubernetesConfiguration/privateLinkScopes resource with the cluster's resource ID in clusterResourceId, and it can live in any resource group.
  • Leave public access on until you've checked it. The scope has a publicNetworkAccess setting. Only turn it off once the agent logs, DNS and endpoint connection checks pass, which is the order I follow below.
  • Flux is the only extension I tried. The feature is aimed at cluster extensions generally, but I've only tested it with Flux, so I can't say how other extensions behave yet.
  • It only covers the data plane endpoint. The private endpoint serves <region>.dp.kubernetesconfiguration.azure.com. Flux also needs outbound access to management.azure.com, login.microsoftonline.com, mcr.microsoft.com and your Git source. As far as I can tell those still go out the normal way, so don't treat this as a full egress lockdown.
  • Watch the DNS zone. In my test, linking a private DNS zone with no A record broke name resolution for the agent, even with public access still enabled. I'll show you how to spot it and fix it below.

Setting it up

I ran everything from PowerShell with the Azure CLI, and I've swapped my names for generic ones. You need the k8s-extension and k8s-configuration CLI extensions, and the Microsoft.KubernetesConfiguration, Microsoft.Kubernetes and Microsoft.ContainerService resource providers registered on the subscription. They were already in place for me, but these commands sort them out if they aren't.

Registration can take a few minutes. az provider show --namespace Microsoft.KubernetesConfiguration --query registrationState should return Registered before you carry on.

Building the cluster and Flux

These variables are used in the rest of the post. Swap in your own names, but keep the region the same for everything.

The cluster goes into my own virtual network, so I can add a second, small subnet for the private endpoint alongside it.

A /27 is plenty for the private endpoint, because it only needs one IP. Next comes the cluster. I used a Free tier cluster with two Standard_D2s_v5 nodes and Azure CNI Overlay, which came up on Kubernetes 1.36.

With the cluster up, install the Flux extension. This is the extension whose agent we're moving onto the private endpoint.

I got version 1.26.6 of microsoft.flux. To prove Flux actually works before changing anything, I added a Flux configuration that deploys the podinfo sample app from GitHub.

After a minute or so it showed Succeeded and Compliant, and the podinfo pods were running in the webapp namespace. My first attempt used the repo's ./kustomize path instead, and that failed with HorizontalPodAutoscaler/podinfo namespace not specified because those manifests don't set a namespace. That's nothing to do with private link, but ./deploy/webapp saves you the detour.

Before creating anything private, I checked where the data plane name resolved from inside the Flux agent. Grab the agent pod name first, because the later checks use it too.

The name already went through a CNAME for uksouth.privatelink.dp.kubernetesconfiguration.azure.com and ended at a public Microsoft address. That's the standard Private Link pattern, and it's why a private DNS zone with that name can take over resolution.

Creating the Private Link Scope

There's no dedicated command for the scope, so it's created with a generic az resource create. I left public network access enabled for now, so Flux keeps working while the private side is built. Passing JSON to the Azure CLI from PowerShell is fiddly with quotes, so I wrote the properties to a file and passed that instead.

It came back Succeeded. I pinned the newest preview API version to be explicit. If you're replacing an old scope on the same cluster, check it with az network private-link-resource list --id and remove it with az resource delete --id first. I started clean, so I didn't need to.

Creating the private endpoint and DNS

The private endpoint targets the scope with the kubernetesconfiguration subresource. These commands create the private DNS zone, link it to the virtual network, create the endpoint and attach a DNS zone group, which is meant to keep the zone's records up to date.

Every command succeeded, and the connection came back Approved straight away. Because I created the endpoint against a resource in my own directory with the right permissions, it was approved automatically.

Azure Portal overview of the private endpoint showing target sub-resource kubernetesconfiguration, connection status Approved and Request/Response Auto-approved

That's where it went wrong. The DNS zone group reported Succeeded, but it didn't write a single record into the zone. The private endpoint knew its FQDN and private IP, and the portal's DNS configuration view even listed them under custom DNS records. The zone group row stayed blank.

Azure Portal DNS configuration for the private endpoint, with the data plane FQDN and a private IP listed under custom DNS records but the DNS zone group row showing no FQDN or IP address

You can spot it from the CLI too. This lists the A records in the zone, and mine came back as an empty list.

An empty zone is worse than no zone. Once it was linked to the virtual network, the data plane name stopped resolving inside the cluster, openssl failed with Name or service not known, and the Flux agent started logging Network error on DP call. Public access was still enabled on the scope, but that didn't help, because the agent couldn't resolve the name to reach either path.

The fix is to make sure the zone has an A record, so I added it at the zone apex myself, using the IP the private endpoint reports.

It still didn't resolve straight away, which I put down to the earlier failed lookup being cached. A minute or two later it resolved to the private IP. I only tested the CLI route, so I can't say whether the portal's Integrate with private DNS zone option writes this record for you. Either way, check the zone has an A record before you go any further.

Checking the traffic really is private

There are three checks worth doing before you trust it. First, the Flux agent logs should show calls to the regional data plane endpoint succeeding.

After the A record was in place, my agent went from network errors back to Successful DP call. Endpoint: getPendingConfigs, ResponseCode: 200 every minute. Next, check where that name resolves and that TLS works from the agent's own container.

I got CONNECTION ESTABLISHED to an address in my private endpoint subnet over TLS 1.3, with a valid Microsoft certificate. If you see a public IP here instead, the traffic isn't using the private endpoint. Finally, check the scope itself shows the endpoint connection as Approved.

Mine returned a single Approved connection, which matched what the portal showed.

Turning off public network access

Once all three checks pass, you can disable public network access on the scope.

The update succeeded. To prove Flux still worked, I created a second Flux configuration afterwards, this time using the shared part of the podinfo sample.

It reached Succeeded and Compliant, and the agent kept logging 200 responses through the private endpoint. Public network requests should now be blocked, although I didn't try to hit the public path to prove it.

Manual approval, troubleshooting and cleanup

If the person creating the endpoint doesn't own the scope, there's a manual approval route. You create the private endpoint by resource ID or alias, and it sits in Pending until someone approves it. I didn't test this, but these are the commands to list and approve the connection.

There's also az network private-endpoint-connection reject, which denies access but keeps the connection record, and delete, which removes it.

If something doesn't work, these are the places I'd look. If the scope won't create, check the Microsoft.KubernetesConfiguration provider is registered, check your permissions, and turn on hidden resource types in the portal. A connection stuck in Pending usually needs manual approval. If DNS doesn't resolve to a private IP, check the zone is linked to the virtual network, the A record exists and any custom DNS servers forward correctly. If the agent logs show errors, check the agent pod, any network policies, the approval state and DNS.

Because my test lived in a single resource group, deleting it removed the cluster, scope, endpoint and DNS zone together, and AKS removed its node resource group with it.

If you're removing it from a cluster you're keeping, I'd set publicNetworkAccess back to Enabled before deleting the private endpoint or DNS zone. With public access disabled and no endpoint, I'd expect the agent to lose its route to the data plane, although I haven't tested that order.

Wrapping up

Private link for AKS extensions does what it says. With a Private Link Scope, a private endpoint and a working DNS zone, my Flux agent talked to its data plane over a private IP and carried on after I disabled public access. The part to get right is DNS, because an empty private zone breaks the agent rather than falling back to the public endpoint. Before you turn public access off, check the zone has its A record and run all three checks.

I'd like to see a dedicated CLI command for the scope, a clear list of supported extensions and the DNS zone group writing its record without any help.

If you try it, let me know how it goes.

Share:
Twitter
LinkedIn
Facebook
Reddit
Follow by Email
Copy link
Threads
Bluesky

Pixel Robots.

I’m Richard Hooper aka Pixel Robots. I started this blog in 2016 for a couple reasons. The first reason was basically just a place for me to store my step by step guides, troubleshooting guides and just plain ideas about being a sysadmin. The second reason was to share what I have learned and found out with other people like me. Hopefully, you can find something useful on the site.

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *