简体   繁体   English

使用哪些 azure 服务(AKS 或 App 服务)在 azure 上部署多个 docker 容器(启用组合)

[英]Which azure services to use ( AKS or App service) to deploy multiple docker containers (compose enabled) on azure

I am trying to deploy multiple web-app containers on azure cloud to implement CI/CD pipeline deployment for production environment.我正在尝试在 azure 云上部署多个 Web 应用程序容器,以实现生产环境的 CI/CD 管道部署。 Currently I have built multiple container images using docker compose file which works totally fine on localhost environment.目前,我已经使用 docker 组合文件构建了多个容器镜像,该文件在本地主机环境中运行良好。 I tried to deploy the docker images to azure container registry and run them using azure web app services but it failed giving error " Cannot map container ports on ACI ".我尝试将 docker 图像部署到 azure 容器注册表并使用 azure web 应用程序服务运行它们,但它未能给出错误“ Cannot map ACI 上的容器端口”。 Looks like ACI doesn't support port mapping!貌似ACI不支持端口映射!

Can anyone suggest me a concrete solution to implement CI/CD deployment for multiple container deployment?谁能建议我为多容器部署实施 CI/CD 部署的具体解决方案?

Technology stack of app: Nodejs and Angular app技术栈:Nodejs和Angular

Docker: Docker desktop for windows (using Linux containers to build the images) Docker:windows 的 Docker 桌面(使用 Linux 容器构建镜像)

Cloud: Azure云:Azure

I don't have much experience in the Devops world, it would be helpful if anyone can guide me at proper path to implement a CI/CD process for multi-container web application.我在 Devops 世界中没有太多经验,如果有人可以指导我以正确的方式为多容器 web 应用程序实施 CI/CD 流程,那将会很有帮助。

Thanks for your time!谢谢你的时间!

Docker compose file: Docker 撰写文件:

version: "3.4"
services:
  frontend:
    build: ./frontend
    ports:
    - "85:80"
    expose:
    - "85"
    - "80"
    networks:
    - dev_network
    depends_on:
    - backend
  backend:
    build: ./backend
    ports:
    - "3000:8600"
    expose:
    - "3000"
    - "8600"
    networks:
    - dev_network
    
networks:
  dev_network:
    driver: bridge

Frontend Docker file:前端 Docker 文件:

# Stage 1: Compile and Build angular codebase

# Use official node image as the base image
FROM node:latest as build

# Set the working directory
WORKDIR /usr/local/app

# Add the source code to app
COPY ./ /usr/local/app/

# Install all the dependencies
RUN npm install

# Stage 2: Serve app with nginx server

FROM nginx:latest

COPY --from=build /usr/local/app/dist/ClientServicePortal /usr/share/nginx/html

# Expose port 80
EXPOSE 80

Backend Docker file:后端Docker文件:

FROM node:14-alpine
ENV NODE_ENV=production
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
COPY . .
EXPOSE 3000 8600
CMD ["node", "server.js"]

I'm not an expert but I think it depends on what kind of of infra/traffic you need for you application.我不是专家,但我认为这取决于您的应用程序需要什么样的基础设施/交通。

AKS allow you to set up scalling, load balancing, traffic control inside the cluster. AKS 允许您在集群内设置缩放、负载平衡和流量控制。 Another advantage, if you are using Azure DevOps tool, is that AKS as a new feature in preview "Deployment center (preview)".如果您使用 Azure DevOps 工具,另一个优势是 AKS 作为预览版“部署中心(预览版)”中的新功能。 This feature will create CI and CD based on a repository.此功能将基于存储库创建 CI 和 CD。 It's a good help to start and see it working, after that you can jump in the config/settings and play with it:)这是一个很好的帮助,开始并看到它工作,之后你可以跳入配置/设置并使用它:)

edit: your docker compose will be replaced by an K8s manifest, but it's "easy" to setup编辑:你的 docker compose 将被 K8s manifest 取代,但设置起来“很容易”

As a by-default recommendation, the following is the main criteria recommended in this guidance:作为默认建议,以下是本指南中推荐的主要标准:

Single monolithic app: Choose Azure App Service N-Tier app: Choose orchestrators such as Azure Kube.netes Service (AKS) or App Service if you have a single or a few back-end services Microservices: Choose AKS or Azure Web Apps for Containers Serverless functions & event handlers: Choose Azure Functions Large-scale Batch: Choose Azure Batch单一整体应用程序:选择 Azure App Service N-Tier 应用程序:选择协调器,例如 Azure Kube.netes 服务 (AKS) 或应用程序服务,如果您有一个或几个后端服务微服务:选择 AKS 或 Azure Web 容器应用程序Serverless functions & event handlers:选择 Azure Functions Large-scale Batch:选择 Azure Batch

AKS vs Azure App Services AKS 与 Azure 应用服务

Azure App Services: Azure 应用服务:

PROS优点

  • It's extremely easy to set up设置起来非常容易
  • Built-in integration with Azure DevOps与 Azure DevOps 的内置集成
  • Works perfectly with applications written in .NET/.NET Core与以 .NET/.NET Core 编写的应用程序完美配合
  • No management overhead (ie no sysadmin activity required)没有管理开销(即不需要系统管理员活动)

CONS缺点

  • Each API needs its own Azure DevOps pipeline setup its own ARM/Terraform template customizations template, application settings, and secrets setup.每个 API 都需要自己的 Azure DevOps 管道设置自己的 ARM/Terraform 模板自定义模板、应用程序设置和机密设置。
  • It is only available in Azure. Even though it leverages docker containers, working with Azure AppService requires Azure training.它仅在 Azure 中可用。尽管它利用了 docker 个容器,但使用 Azure AppService 需要 Azure 培训。
  • There is no way to limit the consumption of memory and CPU services in AppService.没有办法在AppService中限制memory和CPU服务的消耗。
  • In terms of Pricing, AKS is the winner with a 30% average cost saving vs Azure AppService.在定价方面,与 Azure AppService 相比,AKS 平均节省了 30% 的成本。
  • App Services are legacy technology for Microsoft Azure — no major announcements or blog posts since 2017.应用服务是 Microsoft Azure 的遗留技术——自 2017 年以来没有重大公告或博客文章。

Azure Kube.netes Service: Azure Kube.netes服务:

PROS优点

  • No need for ARM template deployments.无需 ARM 模板部署。
  • The AKS 'rollout' process is much faster than the Web Deploy process in App Services. AKS“推出”过程比应用服务中的 Web 部署过程快得多。
  • Additionally, with features such as rolling deployments, readiness and liveness probes, a 'zero-downtime' deployment is much simpler to achieve in AKS.此外,借助滚动部署、就绪性和活动性探测等功能,在 AKS 中实现“零停机”部署要简单得多。
  • Simpler CI/CD更简单的 CI/CD
  • Can control CPU, memory for each container inside a pod可以控制一个pod内每个容器的CPU,memory
  • Automatically: can scale the number of replicas of pods automatically, using the horizontal pod autoscaler or scale the number of nodes of the cluster using the cluster autoscaler. Automatically:可以使用水平pod autoscaler 自动缩放pod 的副本数,或者使用cluster autoscaler 缩放集群的节点数。 Kube.netes can also adjust resources up or down per pod by analyzing CPU and memory consumption by pods using the vertical pod autoscaler. Kube.netes 还可以通过使用垂直 pod 自动缩放器分析 pod 的 CPU 和 memory 消耗来向上或向下调整每个 pod 的资源。 Unfortunately, this feature is not yet supported in AKS.遗憾的是,AKS 尚不支持此功能。
  • Kube.netes is available in most of the cloud providers.大多数云提供商都提供 Kube.netes。 If ever needed, it is possible to move workloads running in Azure Kube.netes Service to other Kube.netes providers like Google Kube.netes Engine(GKE) or Amazon EKS.如果需要,可以将在 Azure Kube.netes 服务中运行的工作负载移动到其他 Kube.netes 提供商,例如 Google Kube.netes Engine (GKE) 或 Amazon EKS。
  • In terms of Pricing, AKS is the winner with a 30% average cost saving vs Azure AppService.在定价方面,与 Azure AppService 相比,AKS 平均节省了 30% 的成本。

CONS缺点

  • Steep learning curve.陡峭的学习曲线。
  • Need to learn kube.netes terminology, kubectl etc.需要学习 kube.netes 术语,kubectl 等。

sources:资料来源:

https://learn.microsoft.com/en-us/do.net/architecture/modernize-with-azure-containers/modernize-existing-apps-to-cloud-optimized/choosing-azure-compute-options-for-container-based-applications https://learn.microsoft.com/en-us/do.net/architecture/modernize-with-azure-containers/modernize-existing-apps-to-cloud-optimized/choosing-azure-compute-options-for-基于容器的应用程序

https://levelup.gitconnected.com/moving-from-azure-app-services-to-azure-kube.netes-service-part-1-e489857c6440 https://levelup.gitconnected.com/moving-from-azure-app-services-to-azure-kube.netes-service-part-1-e489857c6440

https://spltech.co.uk/azure-appservice-vs-azure-kube.netes-service/ https://spltech.co.uk/azure-appservice-vs-azure-kube.netes-service/

https://medium.com/nature-of-clouds/azure-kube.netes-vs-app-services-a-simple-cost-comparison-3800819e3c35 https://medium.com/nature-of-clouds/azure-kube.netes-vs-app-services-a-simple-cost-comparison-3800819e3c35

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 docker-compose 不适用于 Azure 应用服务 - docker-compose not working on Azure App Service ASP.net 核心 docker https on Azure 应用服务容器 - ASP.net core docker https on Azure App Service Containers Azure 应用服务证书 ssl 到 AKS 入口 - Azure App Service Certificate ssl to AKS ingress 部署Azure function到微软Azure中的应用服务 - Deploy Azure function to app service in Microsoft Azure 无法将 React 应用部署到 azure 应用服务 - Cannot deploy a react app to azure app services 如何从github部署到Azure应用服务 - How to Deploy from github to Azure App Service Azure 服务总线 - 如果有多个应用服务实例,如何指定消息的接收者 - Azure Services Bus - How to Specify the Receiver of a Message if there are Multiple App Service Instances 如何从 azure 发布管道查询当前部署到应用程序服务的 docker 图像? - How can I query which docker image is currently deployed to an app service from an azure release pipeline? 如何更新 Azure Kube.netes 服务 (AKS) 的凭据 - how to update the credentials for Azure Kubernetes Service (AKS) Azure应用服务启用持续部署后如何编辑文件 - How to edit files in Azure App Service when continuous deployment is enabled
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM