1 of 29

Kubernetes On Azure

倪朋飞

Microsoft Azure

Kubernetes Maintainer

2 of 29

01

Azure 容器生态

3 of 29

Azure 容器生态

4 of 29

Azure 容器产品

IaaS

PaaS

Azure services

SQL Database

Redis Cache

CosmosDB

And more!

Partner services

OpenShift

Pivotal Cloud Foundry

Docker Enterprise Edition

Mesosphere �DC/OS

Azure

Azure Container Registry (ACR)

OSBA

Azure Kubernetes Service (AKS)

ACS Engine

Batch

Azure Container �Instances (ACI)

Azure Virtual Machines

Virtual Machine �Scale Sets (VMSS)

Service Fabric

Virtual kubelet

App Service

5 of 29

Azure Devops

6 of 29

Azure Kubernetes Service (AKS)

关注应用而不

是基础架构

放心缩放和运行

应用程序

完全开源的

Kubernetes

7 of 29

Azure Container Instance (ACI)

无需管理服务器

就可以运行容器

通过虚拟化保证

容器隔离

AKS 编排

按需弹性突发

8 of 29

Azure Container Registry (ACR)

支持各类容器镜像

和 Helm Charts

跨区域异地复制

自动构建

9 of 29

02

Azure 容器开源

10 of 29

容器开源 @Azure

Virtual Kubelet

ACS Engine

11 of 29

Kubernetes

2位Kubernetes指导

委员会成员

CNCF白金会员

Linux基金会成员

多位 SIG Lead

12 of 29

ACS Engine

尝试最新特性

自定义部署

开源

13 of 29

ACS Engine

  • JSON 描述集群配置
  • 生成 Azure ARM 模版
  • 跨平台:Windows, MacOS and Linux
  • 灵活可配置
    • 多 Agent Pool 支持
    • 自定义网络插件(包括 Azure VNET)
    • Extensions 扩展集群功能

14 of 29

ACS Engine 架构

15 of 29

云原生应用管理

云原生应用开发

部署工具

Kubernetes 应用包

管理部署工具

Kubernetes事件驱动

脚本引擎

Brigade 可视化界面

16 of 29

Open Service Broker

OpenShift

Cloud Foundry

Service Fabric (Coming soon)

Kubernetes�(AKS)

Azure SQL Database

Redis Cache

CosmosDB

And more!

Open Service Broker for Azure (OSBA)

17 of 29

Virtual Kubelet

ACI 无服务器容器

Virtual Kubelet 联结到一起

Kubernetes 编排调度

18 of 29

Virtual Kubelet

Kubernetes control pane

Application architect

Infrastructure architect

Azure Container Instances (ACI)

Virtual Kubelet

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

VM

VM

VM

VM

Deployment

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Pod

Waste

Waste

Waste

Waste

19 of 29

Visual Studio Code

20 of 29

03

Azure Kubernetes Service

21 of 29

Azure Kubernetes Service (AKS)

AKS

Azure 基础架构服务

Docker

Kubernetes

  • 托管的控制平面
        • 高可用
  • 故障自动恢复
  • 自动升级
  • 自动扩展
  • 控制平面完全免费
  • 自定义容器网络
  • Azure 服务深度集成

开发

运维

应用

运维

22 of 29

AKS 优势

特性

AKS

Open Source

Kubernetes 版本

完全一致

集群管理

自动

(部署、故障恢复、自动扩展、升级…)

专门团队运维

(且Node无法自动扩展)

身份认证和访问控制

单点登录

(AAD、RBAC)

开发额外组件

网络

Azure VNET 集成

(Azure CNI)

社区插件

(Flannel,Calico, …)

存储

AzureDisk, AzureFile…

额外存储集群

日志和监控

Azure Monitor

(Application Insights, Log Analytics…)

社区方案

(EFK, Prometheus, …)

价格

按需付费,且控制平面免费

费用高

安全和合规性

Azure安全团队保证

集群的安全性和合规性

专门团队运维

23 of 29

AKS 原理

API server

Controller Manager

Scheduler

etcd Store

Cloud Controller

Self-managed master node(s)

Customer VMs

App/ workload definition

User

Docker

Pods

Docker

Pods

Docker

Pods

Docker

Pods

Docker

Pods

Schedule pods over private tunnel

Kubernetes API endpoint

Azure managed control plane

24 of 29

AKS 示例 – 创建集群

$ az aks create -g resource-group –n myCluster --generate-ssh-keys --enable-rbac

\ Running ..

$ az aks install-cli

Downloading client to /usr/local/bin/kubectl ..

$ az aks get-credentials -g resource-group –n myCluster

Merged “myCluster” as current context ..

$ kubectl get nodes

NAME STATUS ROLES AGE VERSION

aks-nodepool1-42032720-0 Ready agent 1h v1.9.6

aks-nodepool1-42032720-1 Ready agent 1h v1.9.6

aks-nodepool1-42032720-2 Ready agent 1h v1.9.6

25 of 29

AKS示例 – 容器应用

$ kubectl create -f https://git.io/votingapp

deployment.apps/azure-vote-back created

service/azure-vote-back created

deployment.apps/azure-vote-front created

service/azure-vote-front created

$ kubectl get pod

NAME READY STATUS RESTARTS AGE

azure-vote-back-746d4bc54b-rx8w6 1/1 Running 0 114s

azure-vote-front-f747b5d4b-rzbnp 1/1 Running 0 114s

$ kubectl get service

NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

azure-vote-back ClusterIP 10.0.60.54 <none> 6379/TCP 117s

azure-vote-front LoadBalancer 10.0.70.190 52.179.23.131 80:30074/TCP 117s

kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 48m

26 of 29

AKS示例 – 集群管理

  • 缩放集群

  • 升级集群

  • 打开Dashboard

  • 删除集群

$ az aks scale -g resource-group –n myCluster –-node-count 5

$ az aks upgrade -g resource-group –n myCluster –-kubernetes-version 1.11.1

$ az aks browse -g resource-group –n myCluster

$ az aks delete -g resource-group –n myCluster

27 of 29

AKS 监控

28 of 29

AKS控制平面诊断

29 of 29

谢谢观赏!