Professional Documents
Culture Documents
ms/APPS40 #MSIgniteTheTour
将基础架构与 Azure
Kubernetes 服务整合
aka.ms/APPS40 #MSIgniteTheTour
相关资料
本次 Session 相关资料
aka.ms/APPS40
aka.ms/APPS40 #MSIgniteTheTour
Agenda
Tailwind Traders
应用介绍
AKS 架构 介绍 Kubernetes 及其 核心 Components
可扩展性 横向扩展您的应用
aka.ms/APPS40 #MSIgniteTheTour
应用介绍 - Tailwind
Traders
aka.ms/APPS40 #MSIgniteTheTour
Tailwind Traders 组件
aka.ms/APPS40 #MSIgniteTheTour
管理层对我们提出要求
1 弹性
2 安全
3 灵活性
4 伸缩性
aka.ms/APPS40 #MSIgniteTheTour
为什么选择 Kubernetes?
1 提供基础设施无关的标准 API
2 可自愈性
3 可伸缩性
4 可扩展性
aka.ms/APPS40 #MSIgniteTheTour
AKS 架构概览
aka.ms/APPS40 #MSIgniteTheTour
Kubernetes 架构概览
Internet
Kubernetes
control Worker node
kubelet kube-proxy
Docker
Master node
Pods Pods
-controller-
manager -scheduler
Worker node
kubelet kube-proxy
replication, namespace,
serviceaccounts, etc. etcd
Docker
Pods Pods
Containers Containers
aka.ms/APPS40 #MSIgniteTheTour
AKS 架构概览
Azure managed control plane
Controller Cloud
Scheduler Manager Controller
aka.ms/APPS40 #MSIgniteTheTour
AKS 架构 - 网络部分
App Gateway
Kubernetes cluster: Azure VNET
Internal
Load Balancer
External
DNS
Ingress
Control plane
Controller
Namespace
aka.ms/APPS40 #MSIgniteTheTour
AKS 架构 - 虚拟节点
Node Node
Pods Pods
Azure Container
Kubernetes control plane Instances (ACI)
Pods
Serverless Kubernetes
No infrastructure to manage
Virtual Starts in seconds
node
aka.ms/APPS40 #MSIgniteTheTour
AKS 架构 - 可用性区域
Region*
AKS AZs
Region*
AKS AZs
Region*
AKS AZs
aka.ms/APPS40 #MSIgniteTheTour
az commands
创建一个资源组
az group create \
-l <Azure region> \
此资源组包含所有用于实 -n myResGroup
验所创建的资源
aka.ms/APPS40 #MSIgniteTheTour
az commands
创建虚拟网络
az network vnet create \
--resource-group myResGroup \
--name myVnet \
同时也创建了子网,供后
续 AKS 集群使用 --address-prefixes 10.0.0.0/8 \
--subnet-name myVnetSub \
--subnet-prefix 10.240.0.0/16
aka.ms/APPS40 #MSIgniteTheTour
az commands
aka.ms/APPS40 #MSIgniteTheTour
az commands
创建 service principal
az ad sp create-for-rbac \
--name mySPk8s \
可以通过 Service
Principal 创建其他资源
–-role Contributor
aka.ms/APPS40 #MSIgniteTheTour
az commands
创建一个基础的 AKS 集群
az aks create \
--resource-group myResGroup \
--name myAKSCluster \
基础的 AKS 集群 --node-count 3 \
--generate-ssh-keys
aka.ms/APPS40 #MSIgniteTheTour
az commands
添加虚拟节点
az aks enable-addons \
--resource-group myResGroup \
--name myAKSCluster \
添加 虚拟节点的 插件
--addons virtual-node \
--subnet-name VNsubnet
aka.ms/APPS40 #MSIgniteTheTour
通过开启虚拟节点、 CNI 网络
模型、可用性区域,您的集群完
全可以满足企业需求
aka.ms/APPS40 #MSIgniteTheTour
可伸缩性
aka.ms/APPS40 #MSIgniteTheTour
管理层对于功能性的需求
管理层要求我们提供新服务 . 服务必须满足:
• 根据历史数据,为客户提供个性化推荐
• 服务必须是可自动部署
• 必须提供标准的 API 接口文档,实现与其他现有服务集成
aka.ms/APPS40 #MSIgniteTheTour
应对新需求的方案设计
aka.ms/APPS40 #MSIgniteTheTour
可伸缩性技术实现
Cluster Autoscaler
aka.ms/APPS40 #MSIgniteTheTour
可伸缩性技术实现
Horizontal Pod Autoscaler (HPA)
aka.ms/APPS40 #MSIgniteTheTour
基于 Virtual Kubelet 实现的虚拟节点
aka.ms/APPS40 #MSIgniteTheTour
虚拟节点
Linux 容器
Windows 容器
Tip
aka.ms/APPS40 #MSIgniteTheTour
Example.yaml
aka.ms/APPS40 #MSIgniteTheTour
示例 :通过虚拟节点实现
弹性伸缩
aka.ms/APPS40 #MSIgniteTheTour
网络 & 安全
aka.ms/APPS40 #MSIgniteTheTour
AKS 安全实践
aka.ms/APPS40 #MSIgniteTheTour
介绍 Pod Identity
aka.ms/APPS40 #MSIgniteTheTour
介绍 Pod Identity
aka.ms/APPS40 #MSIgniteTheTour
Pod Identity
aka.ms/APPS40 #MSIgniteTheTour
AKS 中 Network Policy 选项
aka.ms/APPS40 #MSIgniteTheTour
AKS 中 Network Policy 选项
Calico Network Policies – Azure CNI 设置本地 Kernel 的路由表 . 规则将被应用在 Pod 的 Nic 上
aka.ms/APPS40 #MSIgniteTheTour
Azure Network Policy
aka.ms/APPS40 #MSIgniteTheTour
Calico Network Policy
aka.ms/APPS40 #MSIgniteTheTour
示例 : Network policies
aka.ms/APPS40 #MSIgniteTheTour
管理失败
aka.ms/APPS40 #MSIgniteTheTour
Availability Zones
Region*
AKS AZs
Region*
AKS AZs
Region*
AKS AZs
aka.ms/APPS40 #MSIgniteTheTour
可用区
1 数据中心故障的恢复能力
2 节点跨区域中的 3 个数据中心拆分
3 向我们提供容错域来规划我们的部署。
aka.ms/APPS40 #MSIgniteTheTour
Availability
zones 目前正 更多更新信息请参考 :
在 Public aka.ms/AKSavailability
Preview
aka.ms/APPS40 #MSIgniteTheTour
管理应用程序的失败 Handling Application Failure
aka.ms/APPS40 #MSIgniteTheTour
Example.yaml
Example deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: webapp-deployment
spec:
处理失败 selector:
matchLabels:
app: webapp
replicas: 3
template:
metadata:
labels:
app: webapp
spec:
containers:
- name: webapp
image: scottyc/webapp:latest
ports:
- containerPort: 3000
hostPort: 3000
aka.ms/APPS40 #MSIgniteTheTour
示例 : 可用性区
aka.ms/APPS40 #MSIgniteTheTour
/MS Learn 提示
完整的学习平台,提供互动性学
习资源,环境,练习以及相对应
的培训视频,帮助云端工程师更
好的使用 Azure 云服务
aka.ms/APPS40MSLearnCollection
aka.ms/APPS40 #MSIgniteTheTour
/Microsoft 认证提醒
• Microsoft 认证 :
Azure Developer Associate
aka.ms/AzureDevCert
• Microsoft 认证 :
Azure DevOps Engineer Expert
aka.ms/DevOpsEngineerCert Get hired, stay ahead, and receive the
recognition you deserve
aka.ms/APPS40 #MSIgniteTheTour
相关资料
本次 Session 相关资料
aka.ms/APPS40
aka.ms/APPS40 #MSIgniteTheTour
Invent with purpose.