Since bitnami redis images have gone commercial now the best open source redis clsuter setup option is to use Valkey, which is guranteed to be open source forever. The source code repos for Valkey is here. We have discussed deploying redis cluster on AKS with bitnami in "Setup Redis Cluster with JSON and Search Modules on AKS with Binami Redis Using Custom Image" However, if we want to deploy Valkey/Redis in cluster in AKS and want to access the Valkey/Redis from outside the AKS cluster, we have to setup AKS networking in a way that each pod is allocated with an IP from the Azure virtual network subnet. In this post let's explore how to setup such an AKS cluster correctly.
Why we need pods in AKS to have IPs from virtual network subnet to deploy Valkey?
When we connect to a Valkey/Redis cluster it always provide diffrent IPs of master nodes to client. Therefore, clients need to acess to IPs of Valkey node pods.
We cannot use Azure CNI overlay for this AKS cluster as it would setup internal network CIDR for pod IPs. Such IPs are not visible outside of AKS. Therefore it is not possible use Azure CNI overlay for AKS clsuter, if we are to deploy Valkey clsuter that should be allowed to access outside of AKS.
We can Azure node subnet mode. But this is not ideal as we have to have a large subnet planned to support boith the node needs as well as pods IP requirement.
The best option is to use Azure CNI Pod Subnet, which would be really useful for this need.
| Feature | Azure CNI Overlay | Azure CNI Pod Subnet | Azure CNI Node Subnet |
|---|---|---|---|
| Pod IP Source | Private overlay network | Dedicated Azure VNet subnet | Same Azure VNet subnet as nodes |
| Node IP Source | Azure VNet subnet | Azure VNet node subnet | Azure VNet subnet |
| Separate Pod Subnet Required | No | Yes | No |
| Pods Consume VNet IP Addresses | No | Yes | Yes |
| Pod IPs Visible in Azure VNet | No | Yes | Yes |
| Azure VM Can Connect Directly to Pod IP | No | Yes | Yes |
| On-premises Can Reach Pod IP Directly | No | Yes (through VPN/ExpressRoute) | Yes (through VPN/ExpressRoute) |
| Requires Kubernetes Service / Gateway / Load Balancer to Reach Pods | Yes | Usually No | Usually No |
| VNet IP Consumption | Very Low | Medium | High |
| Subnet Planning | Simple | Moderate | Requires careful planning |
| Risk of Running Out of VNet IPs | Very Low | Medium | High |
| Supports Large AKS Clusters | Excellent | Excellent | Limited by subnet size |
| Network Performance | Native Azure networking | Native Azure networking | Native Azure networking |
| Maximum Cluster Scalability | Very High | Very High | Depends on available subnet IPs |
| Can Use Different Subnets for Different Node Pools | Yes | Yes | Yes |
| Add New Node Pool in a New Subnet Without Changing Existing Node Pools | Yes | Yes | Yes |
| Easy to Expand by Creating New Node Pool Subnets | Yes | Yes | Yes (recommended when the original subnet is nearly full) |
| Need to Reserve Large Subnets Up Front | No | No | Usually Yes |
| Each Node Pool Can Have Its Own NSG | Yes | Yes | Yes |
| Pods Can Have Separate NSGs from Nodes | No | Yes | No |
| Separate Route Tables for Pods and Nodes | No | Yes | No |
| Simplest Deployment Model | Yes | No | Yes |
| Best IP Address Utilization | Excellent | Good | Poor |
| Can Grow Cluster Without Consuming Many VNet IPs | Yes | No | No |
| Good for Enterprises with Limited VNet Address Space | Excellent | Good | Not Ideal |
| Best Choice for New AKS Deployments | Yes (Microsoft recommendation for most new deployments) | When pods need direct VNet connectivity | Mainly existing deployments or smaller clusters |
| Main Advantage | Excellent scalability while conserving VNet IP addresses. | Pods are first-class Azure network citizens with full VNet visibility. | Simple networking with no dedicated pod subnet. |
| Main Limitation | Pods are not directly reachable using their overlay IP addresses. | Consumes VNet IP addresses for every pod. | Can quickly exhaust subnet IP addresses in growing clusters. |
We can start by setting up required subnets as shown below.
The NSG
Below is the node subnet setup
Then we can setup a pod subnet. Notice that we have to setup the service delegation managed clusters.
Then when we setup AKS for default node pool we need to setu the subnets correctly as shown below.
We have to setup the networking for AKS for Azure CNI pod subnet.
If we are adding other node pools same node and pod subnets can be used. Or for pod subnet we can even have a diffrent subnet.
For setting up Valkey and allow blue green nodepool deployments we can setup below node pools in AKS.
- default system node pool - this is must have for aks
- blue system node pool
- blue self host node pool
- green system node pool
- green self host node pool
We will have only blue or green live. Once workloads shift to new node pool blue or green, old node pool blue or green destroyed to save costs. The apporach is useful to safely upgrade AKS cluster inplace without disrupting the running workloads. When upgrades only new node pools eet deployed with new version of kubernetes and workloads gradgually shifted from all node pool to new, which we will discuss in detail with elatic seach deployment on AKS as in GitHub repo . Note the GitHub repo is still work in progress and complete solution will be explained step by step in future blog posts and repo will evelove to blue green supported elastic deployment on AKS. Similar repo work will be there in future for Valkey as well.
No comments:
Post a Comment