MIT License

技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

GitHub 仓库 “mspnp/aks-baseline”: Azure Kubernetes Service 基线集群详解

项目背景与痛点

微软 Azure Architecture Center 提供的这个基线集群参考实现,为 Azure Kubernetes Service (AKS) 的部署和优化提供了指导。在复杂的微服务架构中,部署、管理和优化 Kubernetes 集群是一个技术上有挑战性的过程。尤其在多云环境下,确保系统稳定性和高性能成为了亟待解决的核心问题。通过这个项目,微软希望帮助开发者构建一个可高度扩展、自动化运维的 Kubernetes 集群基础架构。

AKS 的目标是提供一个基于 Kubernetes 的托管服务,让开发者可以从繁杂的运维配置中解脱出来,并专注于业务应用的开发。然而,现有的许多集群配置方案要么过于简化,忽略了实际生产中的复杂需求;要么过于具体,导致缺乏灵活性和可扩展性。“aks-baseline” 应运而生,它为用户提供了标准化和可扩展化的开发运维方案。

核心技术揭秘

在aks-baseline中,通过一系列最佳实践和预配置脚本,使得开发者能够轻松搭建出一个高可用、高性能的集群。关键的设计原则包括自动缩放、内置健康检查、日志和监控集成、多租户支持等。

架构层面,该集群由多层组成,涵盖了自动部署、服务发现、健康监控和故障转移等功能。各层之间的数据流动采用消息总线设计,保证了低延时的数据传递和异步处理能力。

下面是该技术架构的简要流程图:

graph TD A[用户请求] --> B{"自动缩放检查"} B -->|"需要扩容"| C[触发扩容] C --> D[更新集群状态] B -->|"无需扩容"| D D --> E{"节点健康检查"} E -->|"健康"| F[业务处理] E -->|"不健康"| G[触发失败恢复] G --> H[替换节点] H --> D F --> I[返回结果]

功能亮点与差异

与市场上的同类方案相比,aks-baseline具备以下显著特点:精细化的日志和监控工具集成、高度自动化且可视化的故障恢复机制、基于 Terraform 的可编程部署策略。这些特性赋予了该项目极高的可用性和自修复能力,使得开发者可以将精力更多地投入到核心业务逻辑的开发中。

具体来看,引入了先进的故障探测和故障转移策略,确保了集群在面对外部攻击或内部错误时仍有极低的服务中断风险。同时,通过集成 Kubernetes Service Monitor 模块,实现了对集群运行状态的全面监控。

应用场景与落地建议

在生产环境使用aks-baseline时,需要特别注意对安全性和资源使用情况进行细致的监控。特别是在数据处理量大、系统运行复杂的场景下,如金融交易后台、游戏服务器等,该基线集群展现出了卓越的性能和稳定性。具体落地建议包括定期检查集群健康状况、适时调整自动缩放策略以适应业务量变化,以及借助日志和监控工具及时发现并化解潜在问题。

综合评价

aks-baseline提供了一个优秀的 Kubernetes 集群参考实现,具备健壮的自动化运维和高可用性设计,显著提升了集群管理效率。其主要优点在于完善的自动化运维工具链和有效的故障处理机制。不过,该方案的实现依赖于详尽的设计文档和持续的社区技术支持,因此在普及度和通用性方面尚有提升空间。

总体而言,对于追求可靠服务部署和稳定性的团队,aks-baseline是一个值得考虑的选择。

关于

GitHub 原始描述(英文)

This is the Azure Kubernetes Service (AKS) Baseline Cluster reference implementation as produced by the Microsoft Azure Architecture Center.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

Bicep
Shell

Release

README

Azure Kubernetes Service (AKS) baseline cluster

This reference implementation demonstrates the recommended starting (baseline) infrastructure architecture for a general purpose AKS cluster. This implementation and document is meant to guide an interdisciplinary team or multiple distinct teams like networking, security and development through the process of getting this general purpose baseline infrastructure deployed and understanding the components of it.

We walk through the deployment here in a rather verbose method to help you understand each component of this cluster, ideally teaching you about each layer and providing you with the knowledge necessary to apply it to your workload.

Azure Architecture Center guidance

This project has a companion set of articles that describe challenges, design patterns, and best practices for a secure AKS cluster. You can find this article on the Azure Architecture Center at Azure Kubernetes Service (AKS) baseline cluster. If you haven’t reviewed it, we suggest you read it as it will give added context to the considerations applied in this implementation. Ultimately, this is the direct implementation of that specific architectural guidance.

Architecture

This architecture is infrastructure focused, more so than on workload. It concentrates on the AKS cluster itself, including concerns with identity, post-deployment configuration, secret management, and network topologies.

The implementation presented here is the minimum recommended baseline for most AKS clusters. This implementation integrates with Azure services that deliver observability, provide a network topology that support multiregional growth, and keep the in-cluster traffic secure as well. This architecture should be considered your starting point for pre-production and production stages.

The material here is relatively dense. We strongly encourage you to dedicate time to walk through these instructions, with a mind to learning. Therefore, we do NOT provide any “one click” deployment here. To understand the relationship between the deployed resources, we suggest that you consult the detailed architecture overview while exploring your deployment. Once you’ve understood the components involved and identified the shared responsibilities between your team and your great organization, it is encouraged that you build suitable, auditable deployment processes around your final infrastructure.

Throughout the reference implementation, you will see reference to Contoso Bicycle. It is a fictional small and fast-growing startup that provides online web services to its clientele on the west coast of North America. They have no on-premises datacenters and all their containerized line of business applications are now about to be orchestrated by secure, enterprise-ready AKS clusters. You can read more about their requirements and their IT team composition. This narrative provides grounding for some implementation details, naming conventions, and so on. You should adapt as you see fit.

Finally, this implementation uses the ASP.NET Core Docker sample web app as an example workload. This workload is purposefully uninteresting, as it is here exclusively to help you experience the baseline infrastructure.

Core architecture components

Azure platform
In-cluster OSS components

Network diagram depicting a hub-spoke network with two peered VNets and main Azure resources used in the architecture.

Also do not forget to view the detailed architecture diagram to understand how the deployed resources work together in this reference architecture.

Deploy the reference implementation

A deployment of AKS-hosted workloads typically involves a separation of duties and lifecycle management in the areas of prerequisites, the host network, the cluster infrastructure, and finally the workload itself. Different teams often are responsible for each of these components. This reference implementation follows a similar approach. Also, be aware our primary purpose is to illustrate the topology and decisions of a baseline cluster. We feel a “step-by-step” flow will help you learn the pieces of the solution and give you insight into the relationship between them. Ultimately, lifecycle/SDLC management of your cluster and its dependencies will depend on your situation (team roles, organizational standards, and so on), and will be implemented as appropriate for your needs.

Please start this learning journey in the Preparing for the cluster section. If you follow this through to the end, you’ll have our recommended baseline cluster installed, with an end-to-end sample workload running for you to reference in your own Azure subscription.

1. :rocket: Prepare for the cluster

There are considerations that must be addressed before you start deploying your cluster. Do I have enough permissions in my subscription and AD tenant to do a deployment of this size? How much of this will be handled by my team directly vs having another team be responsible?

2. :electric_plug: Build target network

Microsoft recommends AKS be deployed into a carefully planned network; sized appropriately for your needs and with proper network observability. Organizations typically favor a traditional hub-spoke model, which is reflected in this implementation. While this is a standard hub-spoke model, there are fundamental sizing and portioning considerations included that should be understood.

3. :package: Deploy the cluster

This is the heart of the guidance in this reference implementation; paired with prior network topology guidance. Here you will deploy the Azure resources for your cluster and the adjacent services such as Azure Application Gateway WAF, Azure Monitor, Azure Container Registry, and Azure Key Vault. This is also where you will validate the cluster is bootstrapped.

We perform the prior steps manually here for you to understand the involved components, but we advocate for an automated DevOps process. Therefore, incorporate the prior steps into your CI/CD pipeline, as you would any infrastructure as code (IaC). See the dedicated AKS baseline automation guidance for additional details.

4. :package: Deploy your workload

Without a workload deployed to the cluster it will be hard to see how these decisions come together to work as a reliable application platform for your business. The deployment of this workload would typically follow a CI/CD pattern and may involve even more advanced deployment strategies (such as blue/green). The following steps represent a manual deployment, suitable for illustration purposes of this infrastructure.

5. :checkered_flag: Validate

Now that the cluster and the sample workload is deployed; it’s time to look at how the cluster is functioning.

:broom: Clean up resources

Most of the Azure resources deployed in the prior steps will incur ongoing charges unless removed.

Preview and additional features

Kubernetes and, by extension, AKS are fast-evolving products. The AKS roadmap shows how quickly the product is changing. This reference implementation does take dependencies on select preview features which the AKS team describes as “Shipped & Improving.” The rationale behind that is that many of the preview features stay in that state for only a few months before entering GA. If you are just architecting your cluster today, by the time you’re ready for production, there is a good chance that many of the preview features are nearing or will have hit GA.

This implementation will not include every preview feature, but instead only those that add significant value to a general-purpose cluster. There are some additional preview features you may wish to evaluate in preproduction clusters that augment your posture around security, manageability, and so on. As these features come out of preview, this reference implementation may be updated to incorporate them. Consider trying out and providing feedback on the following:

Advanced topics

This reference implementation intentionally does not cover more advanced scenarios. For example topics like the following are not addressed:

  • Cluster lifecycle management with regard to SDLC and GitOps
  • Workload SDLC integration (including concepts like Bridge to Kubernetes, advanced deployment techniques, Draft, and so on)
  • Container security
  • Multiple (related or unrelated) workloads owned by the same team
  • Multiple workloads owned by disparate teams (AKS as a shared platform in your organization)
  • Cluster-contained state (PV and PVC)
  • Windows node pools
  • Scale-to-zero node pools and event-based scaling (KEDA)
  • Terraform
  • dapr

Keep watching this space, as we build out reference implementation guidance on topics such as these. Further guidance delivered will use this baseline AKS implementation as their starting point. If you would like to contribute or suggest a pattern built on this baseline, please get in touch.

Final thoughts

Kubernetes is a very flexible platform, giving infrastructure and application operators many choices to achieve their business and technology objectives. At points along your journey, you will need to consider when to take dependencies on Azure platform features, OSS solutions, support channels, regulatory compliance, and operational processes. We encourage this reference implementation to be the place for you to start architectural conversations within your own team; adapting to your specific requirements, and ultimately delivering a solution that delights your customers.

Contributions

Please see our Contributor guide.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

With :heart: from Microsoft Patterns & Practices, Azure Architecture Center.

评论

暂无评论