Connecting Azure Kubernetes Service and Azure Database for PostgreSQL
Azure Kubernetes Service (AKS) provides a managed Kubernetes cluster you can use in Azure. Below are some options to consider when using AKS and Azure Database for PostgreSQL together to create an application.
Use accelerated networking-enabled underlying VMs in your AKS cluster. When accelerated networking is enabled on a VM, there is lower latency, reduced jitter, and decreased CPU utilization on the VM. Learn more about how accelerated networking works, the supported OS versions, and supported VM instances for Linux.
From November 2018, AKS supports accelerated networking on those supported VM instances. Accelerated networking is enabled by default on new AKS clusters that use those VMs.
You can confirm whether your AKS cluster has accelerated networking:
- Go to the Azure portal and select your AKS cluster.
- Select the Properties tab.
- Copy the name of the Infrastructure Resource Group.
- Use the portal search bar to locate and open the infrastructure resource group.
- Select a VM in that resource group.
- Go to the VM's Networking tab.
- Confirm whether Accelerated networking is 'Enabled.'
Or through the Azure CLI using the following two commands:
az aks show --resource-group myResourceGroup --name myAKSCluster --query "nodeResourceGroup"
The output will be the generated resource group that AKS creates containing the network interface. Take the "nodeResourceGroup" name and use it in the next command. EnableAcceleratedNetworking will either be true or false:
az network nic list --resource-group nodeResourceGroup -o table
Open Service Broker for Azure
With OSBA, you can create an Azure Database for PostgreSQL server and bind it to your AKS cluster using Kubernetes' native language. Learn about how to use OSBA and Azure Database for PostgreSQL together on the OSBA GitHub page.
A connection pooler minimizes the cost and time associated with creating and closing new connections to the database. The pool is a collection of connections that can be reused.
There are multiple connection poolers you can use with PostgreSQL. One of these is PgBouncer. In the Microsoft Container Registry, we provide a lightweight containerized PgBouncer that can be used in a sidecar to pool connections from AKS to Azure Database for PostgreSQL. Visit the docker hub page to learn how to access and use this image.
Send feedback about: