In right now’s cloud-native world, securing your Kubernetes clusters is extra essential than ever. Conventional IP-based safety measures usually fall quick in dynamic environments the place IP addresses change ceaselessly. That is the place Totally Certified Area Identify (FQDN) filtering comes into play, providing a extra environment friendly and scalable method to handle community insurance policies. On this weblog put up, we’ll discover how Azure Kubernetes Service (AKS) leverages FQDN filtering by way of Superior Container Networking Companies (ACNS) to reinforce your cluster’s safety.
What’s FQDN Filtering?
FQDN filtering permits you to outline community insurance policies primarily based on domains quite than IP addresses. This method simplifies coverage administration by eliminating the necessity to replace insurance policies every time IP addresses change, a standard prevalence in Kubernetes clusters the place pods are ephemeral.
Why FQDN Filtering Issues
- Scalable Coverage Administration: Handle community insurance policies extra effectively with out consistently updating IP addresses.
- Enhanced Safety Compliance: Implement zero-trust safety fashions by limiting site visitors to trusted domains.
- Resilient Coverage Enforcement: Guarantee steady DNS decision and coverage enforcement even throughout part upgrades or failures.
Superior Container Networking Companies (ACNS)
ACNS is an add-on for AKS that gives superior networking options, together with observability and enhanced safety measures like FQDN filtering. For those who’re fascinated about studying extra about ACNS’s observability options, take a look at my earlier put up: Superior Community Observability: Supercharging Container Community Observability in Azure Kubernetes Service (AKS).
How Does FQDN Filtering Work in AKS?
When FQDN filtering is enabled, DNS requests from pods are intercepted and evaluated towards outlined community insurance policies. Right here’s a high-level overview:
- DNS Request Redirection: The Cilium Agent marks DNS request packets from pods implementing FQDN insurance policies, redirecting them to the ACNS DNS Proxy.
- Coverage Analysis: The DNS Proxy checks if the DNS request matches the allowed domains specified within the community coverage.
- DNS Decision and Coverage Replace: If permitted, the DNS Proxy forwards the request to the DNS server. Upon receiving the response, it updates the Cilium Agent with the FQDN-to-IP mappings.
- Community Coverage Enforcement: The Cilium Agent updates the community coverage, guaranteeing that pods can talk solely with the desired domains.

Setting Up FQDN Filtering in AKS
Earlier than we dive into instructions, let’s make sure you meet the conditions.
Conditions
- Azure CLI: Guarantee you’ve got Azure CLI model 2.56.0 or later put in.
- AKS Cluster with Cilium: FQDN filtering requires AKS clusters utilizing Azure CNI powered by Cilium and Kubernetes model 1.29 or higher.
Allow the AdvancedNetworkingPreview
Characteristic Flag
First, you’ll want to put in or replace the aks-preview
Azure CLI extension. Run the next instructions to put in the required extensions.
az extension add —identify aks–preview az extension replace —identify aks–preview |
Subsequent, register the function flag for Superior Networking Preview utilizing the command under:
az function register —namespace “Microsoft.ContainerService” —identify “AdvancedNetworkingPreview” |
After a couple of moments, verify the registration standing to make sure the function is prepared:
az function present —namespace “Microsoft.ContainerService” —identify “AdvancedNetworkingPreview” |
As soon as the registration is full, refresh the useful resource supplier with the next command:
az supplier register —namespace Microsoft.ContainerService |
Create an AKS Cluster with ACNS and FQDN Filtering
Now that you simply’ve enabled the mandatory options, you’ll be able to create a brand new AKS cluster with ACNS enabled (each Observability and FQDN filtering). Use the next command to create the cluster, simply dont overlook a useful resource group and alter the cluster identify and useful resource group to match your wants:
az aks create —identify aks–cluster–identify> —useful resource–group useful resource–group–identify> —generate–ssh–keys —community–plugin azure —community–plugin–mode overlay —pod–cidr 192.168.0.0/16 —community–dataplane cilium —allow–acns |
It will deploy a brand new AKS cluster with all ACNS options, together with FQDN filtering and community observability.
Create an AKS Cluster with FQDN Filtering (With out ACNS Observability)
For those who’re solely fascinated about enabling FQDN filtering with out activating the broader ACNS options, similar to community observability, you should use the next command. The --enable-fqdn-policy
flag focuses solely on domain-based filtering, decreasing overhead and value by avoiding ACNS observability.
az aks create —identify aks–cluster–identify> —useful resource–group useful resource–group–identify> —generate–ssh–keys —community–plugin azure —community–plugin–mode overlay —pod–cidr 192.168.0.0/16 —community–dataplane cilium —allow–fqdn–coverage |
This command creates a brand new AKS cluster with FQDN filtering enabled, permitting you to handle community insurance policies primarily based on domains. It’s helpful if you’d like simplified coverage administration however don’t require ACNS observability.
Enabling FQDN Filtering on an Current Cluster
You probably have an present AKS cluster, you’ll be able to nonetheless allow FQDN filtering and observability by updating the cluster. Guarantee your cluster makes use of the Cilium knowledge aircraft, then run the next command:
az aks replace —useful resource–group useful resource–group–identify> —identify aks–cluster–identify> —allow–acns |
This command will replace your cluster to assist ACNS, together with FQDN filtering.
Enabling FQDN Filtering on an Current Cluster (With out ACNS Observability)
If you have already got an present AKS cluster and want to add FQDN filtering with out enabling all ACNS options, you’ll be able to replace your cluster utilizing the next command. That is perfect in case you’re in search of domain-based safety with out further monitoring capabilities.
az aks replace —useful resource–group useful resource–group–identify> —identify aks–cluster–identify> —allow–fqdn–coverage |
This command updates your present AKS cluster to allow FQDN filtering. With this, you’ll be able to implement community insurance policies which might be simpler to handle whereas retaining your cluster light-weight by avoiding the total ACNS suite.
Implementing FQDN-Primarily based Community Insurance policies
When you’ve enabled FQDN filtering, you can begin creating community insurance policies that use domains to handle pod communication. Right here’s an instance of a CiliumNetworkPolicy
that permits egress site visitors solely to the area pixelrobots.co.uk
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
apiVersion: cilium.io/v2 type: CiliumNetworkPolicy metadata: identify: allow-pixelrobots-co-uk namespace: my-namespace spec: endpointSelector: matchLabels: app: my-app egress: – toFQDNs: – matchName: “pixelrobots.co.uk” – toEndpoints: – matchLabels: “k8s:io.kubernetes.pod.namespace”: kube-system “k8s:k8s-app”: kube-dns toPorts: – ports: – port: “53” protocol: ANY guidelines: dns: – matchPattern: “*” |
On this coverage:
- All site visitors is blocked apart from DNS site visitors to the Kubernetes DNS server and site visitors to
pixelrobots.co.uk
. - Pods with the label
app=my-app
within the namespacemy-namespace
are allowed to speak with the areapixelrobots.co.uk
.
Notice: Ensure you permit site visitors to kube-dns
, as it’s important for resolving FQDNs within the cluster.
Advantages of FQDN Filtering
By implementing FQDN filtering in your AKS clusters, you acquire a number of key benefits:
- Simplified Administration: There’s no must consistently observe and replace altering IP addresses of exterior providers.
- Improved Safety: FQDN filtering permits you to implement a zero-trust safety mannequin by controlling which domains pods can talk with.
- Excessive Availability: The ACNS DNS Proxy ensures that DNS decision continues even throughout upgrades or failures of the Cilium agent, retaining your safety insurance policies intact.
Issues
- Value: Understand that ACNS incurs further prices, roughly $18 per node monthly ($0.025 per node per hour).
- Preview Characteristic: As of this writing, ACNS is in preview. Be cautious when deploying this function in manufacturing environments.
- Cilium Information Airplane: FQDN filtering requires the Cilium community knowledge aircraft, which can require recreating present clusters in the event that they aren’t utilizing Cilium.
Conclusion
FQDN filtering in AKS gives a robust software for managing community safety in a dynamic, cloud-native atmosphere. By shifting from IP-based insurance policies to domain-based insurance policies, you’ll be able to simplify your safety operations, improve compliance with zero-trust fashions, and preserve coverage enforcement even throughout system upgrades.
For those who’re already utilizing AKS and in search of methods to enhance safety, enabling Superior Container Networking Companies with FQDN filtering is a superb place to begin. Simply you’ll want to check it completely in a non-production atmosphere earlier than rolling it out cluster-wide.
References
Thanks for studying! Be at liberty to go away a remark or attain out in case you have any questions or insights to share.