
Azure AKS is a managed container service that allows you to deploy and manage containerized applications at scale.
Azure AKS provides a highly available and scalable platform for running containerized workloads.
To build a scalable and secure microservices architecture, you can use Azure AKS with Azure Kubernetes Service (AKS).
AKS allows you to define and deploy containerized applications using YAML files, which can be managed using Azure DevOps.
This approach enables you to automate the deployment and scaling of your containerized applications.
By using AKS, you can take advantage of Azure's managed services, including Azure Monitor, Azure Policy, and Azure Security Center, to ensure the security and reliability of your microservices architecture.
Security and Compliance
To secure your Azure AKS architecture, it's essential to implement threat monitoring using Microsoft Defender for Containers or a 3rd party capability. This will help identify and remediate potential security risks.
You should also continuously monitor images and running containers for known vulnerabilities using Microsoft Defender for Cloud or a 3rd party solution available through the Azure Marketplace. This will ensure that your container images are up-to-date and secure.
Azure AKS provides a range of security features, including Azure RBAC for Kubernetes authorization, which enforces authorization checks on the cluster. This approach is recommended over using Kubernetes native RBAC.
Here are some key security features provided by Azure AKS:
By implementing these security features, you can ensure that your Azure AKS architecture is secure and compliant with industry standards.
TLS/SSL Encryption
TLS/SSL encryption is a crucial aspect of securing network traffic in a Kubernetes cluster. It's used to protect data in transit between the client and the workload.
In common implementations, the Ingress controller is used for SSL termination. This means you'll need to create a TLS certificate as part of deploying the Ingress controller. Only use self-signed certificates for dev/test purposes.
For production workloads, it's recommended to get signed certificates from trusted certificate authorities (CA). Let's Encrypt certificates can be generated and configured for use with the Ingress controller.
You may also need to rotate your certificates as per your organization's policies. This ensures that your certificates remain valid and secure over time.
Here's a summary of the certificate types and their uses:
- Self-signed certificates: Use for dev/test purposes only.
- Trusted certificate authorities (CA): Use for production workloads to obtain signed certificates.
- Let's Encrypt certificates: Use for generating and configuring certificates with the Ingress controller.
Policy
Security and compliance are crucial for any Kubernetes cluster. To ensure that your cluster is secure and compliant, you should implement a robust policy framework. This framework should include role-based access control (RBAC) to manage user and group permissions.
Kubernetes supports RBAC through the use of Role and ClusterRole objects for cluster-wide permissions, and RoleBinding and ClusterRoleBinding objects to assign users and groups to those permissions. For example, you can use the built-in roles such as cluster-admin, edit, and view, and bind them to Microsoft Entra users and groups to manage access.
You can also use Azure RBAC for Kubernetes authorization, which enforces authorization checks on the cluster. This approach allows you to assign Azure roles to the cluster's managed identities, depending on the operations that the cluster does. For instance, you can assign the Network Contributor role to manage the cluster's ability to control the spoke virtual network.
Here are some examples of Azure built-in roles that you can assign to the cluster's managed identities:
- Network Contributor role: manages the cluster's ability to control the spoke virtual network
- Monitoring Metrics Publisher role: manages the cluster's ability to send metrics to Azure Monitor
- AcrPull role: manages the cluster's ability to pull images from the specified Azure Container Registry instances
Using a policy framework like Azure RBAC provides several advantages, such as centralized control of permissions, ensuring that all permissions are encrypted at rest, centralized key management, access control of permissions, and auditing.
Secrets and Credentials
Using managed identities is a great way to keep your application credentials safe, but it's not a foolproof solution. Currently, not all Azure services support authentication using managed identities.
To store sensitive data, you have several options, including Azure Key Vault, HashiCorp Vault, and Kubernetes secrets. Each has its own advantages and disadvantages.
Azure Key Vault is a great option for storing secrets securely. It provides centralized control of secrets, ensures they're encrypted at rest, and offers centralized key management.
HashiCorp Vault is another popular choice for storing secrets. It integrates well with Microsoft Entra managed identities and provides strong encryption and an access audit log.
Using a secrets store CSI driver is a convenient way to access cluster secrets. This driver connects with a specified store, retrieves a secret, and mounts it as a volume in the cluster.
Here are some options for storing secrets securely:
- Azure Key Vault: provides centralized control of secrets, ensures they're encrypted at rest, and offers centralized key management.
- HashiCorp Vault: integrates well with Microsoft Entra managed identities and provides strong encryption and an access audit log.
- Kubernetes secrets: stored in etcd, which is a distributed key-value store, and encrypted at rest.
Container and Orchestration Security
Container and Orchestration Security is a crucial aspect of ensuring the security and compliance of your containerized applications. You should monitor for threats using Microsoft Defender for Containers or a 3rd party capability.
Threat monitoring is essential to identify and remediate potential security risks. Microsoft Defender for Containers regularly scans container images for vulnerabilities and generates real-time security alerts for suspicious activities. This helps to keep your container infrastructure secure and protected from active threats.
To secure your containers, you should continuously monitor images and running containers for known vulnerabilities using Microsoft Defender for Cloud or a 3rd party solution. This ensures that you are aware of any potential security risks and can take action to remediate them.
Automating image patching is also an effective way to ensure the security of your containers. Azure Container Registry (ACR) Tasks can help automate this process by updating, testing, and redeploying container images.
Here are some best practices for securing your containers:
- Monitor for threats using Microsoft Defender for Containers or a 3rd party capability.
- Continuously monitor images and running containers for known vulnerabilities using Microsoft Defender for Cloud or a 3rd party solution.
- Automate image patching using ACR Tasks.
- Store images in a trusted private registry such as Azure Container Registry or Docker Trusted Registry.
- Apply the Least Privilege principle.
Works?
Azure AKS is a powerful tool for managing and deploying container-based applications. It automates and streamlines the application migration into a container, making it a convenient option for cloud applications.
The AKS service uses a specified scope to contain the number of use cases in the service. This means you only pay for the agent nodes, while the master node is configured and deployed automatically.
Azure virtual network and Azure virtual network interface are key components of AKS. They work together to provide a secure and reliable environment for your containers.
The AKS service also includes Kube-proxy, which is a critical component for managing and deploying containers. Container runtime and Kubelet are also essential components, providing the necessary infrastructure for your containers to run.
Here are some of the key components that make up Azure AKS:
- Azure virtual network
- Azure virtual network interface
- Kube-proxy
- Container
- Azure files
- Azure disk
- Kubelet
- Container runtime
By using Azure AKS, you can manage your cloud applications with ease, without having to worry about the underlying infrastructure. It's a convenient and cost-effective way to deploy and manage your containers.
Data Storage and Management
In a microservices architecture, each service should manage its own data set to avoid hidden dependencies among services. This means services should not share data storage solutions.
Using an external service like Azure SQL Database or Azure Cosmos DB is a good option for storing persistent data. This way, the data is not tied to a specific node.
For distributed storage, Azure Data Lake Storage Gen2 (ADLS) is required to be configured on AKS. This is a specific requirement for Dremio.
Data Storage
In a microservices architecture, each service should manage its own data set to avoid hidden dependencies among services. This helps prevent unintentional coupling between services, which can happen when services share the same underlying data schemas.
Storing persistent data in local cluster storage ties the data to the node, so it's better to use an external service like Azure SQL Database or Azure Cosmos DB. Another option is to mount a persistent data volume to a solution using Azure Disks or Azure Files.
Dremio requires a specific storage class for certain storages, including a 512 GB Coordinator volume, 256 GB Executor volume #1, 256 GB Executor volume #2, and a 16 GB ZooKeeper volume. All these require the AKS Storage Class “managed-premium” (i.e. Azure Managed Disks).
For executors, using local disks instead of Azure Managed Disks can provide significantly faster I/O performance, especially if the node provides at least 500 GB of local SSD/NVMe storage. Local NVMe storage provides faster I/O compared to network-attached "managed-premium" disks.
Dremio also requires Azure Data Lake Storage Gen2 (ADLS) to be configured as distributed storage on AKS.
Container Registry
When using Dremio, you should push required Docker images to a private container registry.
For instance, Dremio Enterprise Edition, ZooKeeper, and Nessie images should be hosted in a private registry like Azure Container Registry.
Dremio doesn't provide service-level agreements (SLAs) for Quay.io and docker.io repositories, so it's best to use a private registry for your images.
What is Services?
In the world of data storage and management, services play a crucial role in making our lives easier.
The Azure Kubernetes Service (AKS) is a prime example of this, a managed container orchestration service based on the Kubernetes system.
AKS has been available since June 2018, making it a relatively new player in the game.
It's primarily used in software development, helping organizations like ours to build scalable applications using Docker.
AKS is an open-source platform that simplifies the process of managing multiple overheads and reducing the complexity of management tasks.
This is a huge advantage for developers, as it allows them to focus on what they do best - building great software.
Deployment and Configuration
In a robust CI/CD process for a microservices architecture, each team can build and deploy the services that it owns independently, without affecting or disrupting other teams. This is achieved by deploying to dev/test/QA environments for validation before moving to production.
To ensure high availability, it's recommended to deploy at least two nodes in the AKS cluster. This allows the workload to have a high availability pattern with two replicas. With AKS, you can change the node count without recreating the cluster.
When planning node sizes, consider using a smaller VM size for the system node pool to minimize costs. For example, the reference implementation deploys the system node pool with three DS2_v2 nodes, which is sufficient to meet the expected load of the system pods.
Configuration
Configuration is a crucial step in the deployment process, and it's essential to get it right. You can choose a smaller VM size for the system node pool to minimize costs, as deploying the system node pool with three DS2_v2 nodes is sufficient to meet the expected load of the system pods.
To pack the maximum number of pods on a node, consider using larger node sizes. This minimizes the footprint of services that run on all nodes, such as monitoring and logging. The operating system disk is 512 GB.
For workload requirements, select the appropriate VM type, such as a memory-optimized product or a GPU-accelerated product. For more information, see Sizes for virtual machines in Azure.
Deploy at least two nodes to achieve a high availability pattern with two replicas. With AKS, you can change the node count without recreating the cluster.
Here are some key considerations for configuring your cluster:
- Choose larger node sizes to pack the maximum number of pods on a node.
- Select the appropriate VM type based on your workload requirements.
- Deploy at least two nodes for high availability.
- Plan actual node sizes based on workload requirements determined by your design team.
- Assume 20% of each node is reserved for AKS services when planning capacity.
- Set the maximum pods per node based on your capacity planning.
Resource contention can affect availability, so define resource constraints for containers to prevent a single container from overwhelming cluster resources. Use resource quotas to limit total resources allowed for a namespace.
Consider using the Bulkhead Pattern to isolate resources for non-container resources such as threads or network connections. This helps prevent resource starvation between front-end and back-end services.
Deployment (Ci/Cd) Considerations
Having a robust CI/CD process is crucial for a microservices architecture. It allows each team to build and deploy the services they own independently without affecting other teams.
Each team can build and deploy their services independently, thanks to a well-designed CI/CD process. This is a key goal of a robust CI/CD process.
Before a new version of a service is deployed to production, it gets deployed to dev/test/QA environments for validation. This ensures that the new version meets quality standards.
Quality gates are enforced at each stage of the CI/CD process. This helps catch any issues early on and prevents them from making it to production.
A new version of a service can be deployed side by side with the previous version. This allows for easy rollbacks and minimizes disruption to users.
Sufficient access control policies are in place to ensure that only authorized personnel can deploy changes to production. This is a critical aspect of a robust CI/CD process.
Here are some key goals of a robust CI/CD process:
- Each team can build and deploy the services that it owns independently, without affecting or disrupting other teams.
- Before a new version of a service is deployed to production, it gets deployed to dev/test/QA environments for validation.
- A new version of a service can be deployed side by side with the previous version.
- Sufficient access control policies are in place.
- For containerized workloads, you can trust the container images that are deployed to production.
Service
Azure Kubernetes Service (AKS) offers a cost-effective solution for deploying and managing Kubernetes clusters.
You won't be charged for the deployment, management, and operations of the Kubernetes cluster itself.
The only costs associated are for the virtual machine instances, storage, and networking resources consumed by your cluster.
To get an estimate of the costs, check out the Container Services calculator.
In-Place Upgrades
In-Place Upgrades can be a game-changer for smooth deployments.
In this method, you can upgrade your system without disrupting its operation, as it only involves replacing the old software with the new version without modifying the underlying infrastructure.
This approach is particularly useful when you have a large and complex system to maintain, as it minimizes downtime and reduces the risk of errors.
You can perform in-place upgrades using the "rolling update" technique, where you upgrade one node at a time, ensuring that the system remains available and stable throughout the process.
By doing so, you can avoid the hassle of coordinating a large-scale upgrade and reduce the likelihood of unexpected issues arising.
In-place upgrades also allow you to test the new version in a controlled environment before rolling it out to the entire system, which can help you identify and fix any potential problems.
This approach is often preferred over other methods, such as re-deployment, because it's faster and more efficient, reducing the overall time and effort required for the upgrade process.
Frequently Asked Questions
How does Azure Aks work?
Azure AKS manages Kubernetes clusters in Azure, freeing developers from tasks like health monitoring and maintenance. You only need to manage agent nodes and pay for them, simplifying the process.
What is the structure of AKS cluster?
An AKS cluster consists of two main components: the control plane, which manages Kubernetes services, and nodes, which are virtual machines that run applications. Understanding the structure of an AKS cluster is key to optimizing its performance and scalability.
Sources
- https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/containers/aks-microservices/aks-microservices
- https://learn.microsoft.com/en-us/azure/architecture/reference-architectures/containers/aks/baseline-aks
- https://docs.dremio.com/current/get-started/cluster-deployments/deployment-models/azure-deployments/azure-aks/
- https://www.educba.com/azure-kubernetes-services-aks/
- https://roshancloudarchitect.me/scaling-microservices-with-azure-kubernetes-service-aks-and-event-driven-architecture-74900e350447
Featured Images: pexels.com