第12章クラウドネイティブアプリケーション開発
API-Based FrameworkAPIを基にしたフレームワーク
Microservices that rely on each other communicate using well-defined APIs. These APIs help configure the infrastructure layers to facilitate resource sharing across them. APIs connect microservices and containers while providing simplified maintenance and security. They enable microservices to communicate between otherwise loosely coupled services without sharing the same technology stacks, libraries, or frameworks. Cloud-native microservices use lightweight APIs that are based on protocols such as representational state transfer to expose their functionality. The architectural style for providing standards between resources so they can communicate with each other over the Web is called representational state transfer (REST).
英語のヒント
互いに依存するマイクロサービスは、明確に定義されたAPIを使って通信する。これらのAPIは、基盤となる各層を設定し、その間で資源を共有しやすくする。APIは、マイクロサービスとコンテナーをつなぎ、保守とセキュリティを簡潔にする。これにより、同じ技術スタック、ライブラリ、フレームワークを共有せずに、それ以外の点では疎結合なサービス同士で通信できる。クラウドネイティブなマイクロサービスは、representational state transferなどのプロトコルに基づく軽量なAPIを使い、機能を公開する。リソースがWeb上で互いに通信できるよう、その間の標準を定めるアーキテクチャスタイルを、representational state transfer(REST)という。
Dynamically Orchestrated Framework動的にオーケストレーションを行うフレームワーク
As already mentioned, the scheduling and orchestration layer of a cloud computing framework manages the containers microservices are deployed in. As applications grow to span multiple containers deployed across multiple servers, operating them becomes more complicated. Container orchestration tools (e.g., Kubernetes) can help coordinate and schedule many containers. They can also help scale container instances to provide more computational power. For example, the orchestration tool, depicted as “Master” in Figure 12.15, deploys the microservices in containers (single instances, initially) of an application on a computing resource.
英語のヒント
前述したように、クラウドコンピューティングのフレームワークのスケジューリングとオーケストレーションの層は、マイクロサービスが配置されるコンテナーを管理する。アプリケーションが大きくなり、複数のサーバーに配置された複数のコンテナーへ広がると、運用は複雑になる。Kubernetesなどのコンテナーオーケストレーションツールは、多数のコンテナーの調整とスケジューリングを支援する。より多くの計算能力を提供するために、コンテナーのインスタンスを拡張することも支援できる。たとえば、図12.15で“Master”と表されるオーケストレーションツールは、アプリケーションのマイクロサービスを、コンピューティング資源上のコンテナー(最初は各1インスタンス)へ配置する。

attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license · CC BY 4.0 · Source出典
Figure 12.15 Container orchestration is used to manage microservices in a cloud-native application. (attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license)
図12.15 コンテナーオーケストレーションを使い、クラウドネイティブアプリケーションのマイクロサービスを管理する。(出典:Copyright Rice University, OpenStax、CC BY 4.0ライセンス)
As the microservices’ consumption of the computing resources increases, additional resources are added, and the orchestration tool will start scheduling and scaling the microservices. An orchestration platform helps schedule the microservices and containers and optimizes the use of the computing resource. In contrast, a monolith application is not designed to leverage an orchestration platform and requires the use of load balancers. Other services, such as service discovery, also need to be performed manually. For example, if microservices need to communicate with one another, they cannot find the IP addresses of their respective containers and check if they are running. This is handled automatically by the orchestration platform (i.e., Microsoft AKS, Amazon AWS EKS, Google GKE). An orchestration platform typically runs workloads by placing corresponding containers into pods that run on nodes (i.e., a virtual or physical machine). Multiple nodes are typically grouped into clusters to ensure scalability. Pods are the smallest deployable units of computing; they group multiple containers, provide shared storage and network resources, and specify how to run the containers. The orchestration platform provides support when a pod that contains a running microservice container goes down. In that case, another pod is brought up rapidly and brings it within the purview of that service automatically. Figure 12.16 shows how microservice containers are scaled and managed in the case of failure.
英語のヒント
マイクロサービスによるコンピューティング資源の消費が増えると、資源が追加され、オーケストレーションツールがサービスのスケジューリングと拡張を始める。オーケストレーションのプラットフォームは、サービスとコンテナーのスケジューリングを助け、計算資源の利用を最適化する。これに対し、モノリスのアプリケーションは、オーケストレーションのプラットフォームを活用するよう設計されておらず、ロードバランサーが必要になる。サービスディスカバリーなども手作業で行わなければならない。たとえば、マイクロサービス同士が通信する必要がある場合、それぞれのコンテナーのIPアドレスを見つけ、動作しているかを確認することができない。この処理は、Microsoft AKS、Amazon AWS EKS、Google GKEなどのオーケストレーションプラットフォームが、自動的に行う。オーケストレーションプラットフォームは、通常、対応するコンテナーをポッドへ配置してワークロードを動かす。ポッドは、仮想マシンまたは物理マシンであるノード上で動作する。スケーラビリティを確保するため、通常、複数のノードをクラスターへまとめる。ポッドは、配置できる計算処理の最小単位である。複数のコンテナーをまとめ、共有の記憶領域とネットワーク資源を提供し、コンテナーの実行方法を指定する。動作中のマイクロサービスのコンテナーを含むポッドが停止すると、オーケストレーションプラットフォームが支援する。その場合、別のポッドを素早く起動し、自動的にそのサービスの管理対象へ加える。図12.16は、マイクロサービスのコンテナーを拡張し、障害時に管理する方法を示している。

attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license · CC BY 4.0 · Source出典
Figure 12.16 Container orchestration is used to auto-scale and perform health-checking of microservices in a scaled cloud-native application. (attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license)
図12.16 コンテナーオーケストレーションを使い、拡張したクラウドネイティブアプリケーションのマイクロサービスを、自動拡張し、稼働状態を確認する。(出典:Copyright Rice University, OpenStax、CC BY 4.0ライセンス)
Agile DevOps and Automation using CI/CDアジャイルなDevOpsとCI/CDによる自動化
DevOps is a methodology that combines Agile software development and IT operations to deliver software faster and of higher quality. Because DevOps and cloud native focus on different aspects of the application development process, they complement each other in facilitating agility. DevOps focuses on the principles and practices used in development and operations. A goal of DevOps is to ensure that all team members are cross-functional, so they have a single mindset on improving customer experiences, responding faster to business needs, and ensuring that innovation is balanced with security and operational needs. Cloud native, on the other hand, focuses on the application environment and how to scale and deliver software more efficiently.
英語のヒント
DevOpsは、アジャイルなソフトウェア開発とIT運用を組み合わせ、より速く、より高品質なソフトウェアを届ける方法論である。DevOpsとクラウドネイティブは、開発過程の異なる側面に注目するため、俊敏性を高めるうえで互いに補完し合う。DevOpsは、開発と運用で使う原則と実践に焦点を当てる。目標の1つは、すべてのメンバーが職能を横断して働けるようにし、顧客体験の改善、事業の必要への迅速な対応、革新とセキュリティ・運用上の必要との両立について、共通の考え方を持てるようにすることである。一方、クラウドネイティブは、アプリケーションの環境と、ソフトウェアをより効率的に拡張し、届ける方法に焦点を当てる。
The use of a DevOps pipeline to migrate an application toward a microservices architecture achieves the goals of automation, discipline, and repeatability while reducing some of the challenges already identified. As a cloud-native application works its way through the DevOps pipeline, it also moves toward continuous delivery.
英語のヒント
DevOpsのパイプラインを使って、アプリケーションをマイクロサービスアーキテクチャへ移行すると、すでに挙げた課題の一部を減らしながら、自動化、手順の規律、反復可能性という目標を達成できる。クラウドネイティブアプリケーションは、DevOpsパイプラインを進むにつれて、継続的デリバリーにも近づく。
Figure 12.17 shows continuous integration and continuous deployment (CI/CD), which is a set of DevOps operating principles that enable development teams to focus on rapid and frequent integrations of new code into the application in development as well as fast and frequent delivery or deployment of new iterations of the application. It allows teams to deliver code changes more frequently and reliably. A DevOps team establishes a CI/CD pipeline, which is a series of steps needed for integration and delivery or deployment that includes the build process through which the application is compiled, built, packaged, and tested. The continuous integration part automates the application compile, build, package, and testing process, enabling it to run independent of physical resources, which allows for a more consistent integration process. This improves team communication and leads to better software quality. The continuous delivery part goes a step further and automates the deployment stage as well. During this phase, the application is deployed to selected infrastructure environments. Packages built during CI are deployed into multiple environments (e.g., development, staging). The application build undergoes integration and performance tests. Finally, the application is deployed into production and made available to end users.
英語のヒント
図12.17は、継続的インテグレーションと継続的デプロイメント(CI/CD)を示している。これは、開発中のアプリケーションへ新しいコードを素早く頻繁に統合し、新しい反復版を素早く頻繁に提供・配置することに、開発チームが集中できるようにする、DevOpsの運用原則の集合である。これにより、コードの変更を、より頻繁に、確実に届けられる。DevOpsチームは、CI/CDパイプラインを構築する。これは、統合と提供または配置に必要な一連の手順であり、アプリケーションのコンパイル、ビルド、パッケージ化、テストを行うビルド過程を含む。継続的インテグレーションの部分は、コンパイル・ビルド・パッケージ化・テストを自動化し、物理資源に依存せず実行できるようにすることで、統合の過程をより一貫したものにする。これにより、チームの意思疎通とソフトウェアの品質が向上する。継続的デリバリーの部分は、さらに一歩進めて、配置の段階も自動化する。この段階では、選択した基盤環境へアプリケーションを配置する。CIで作ったパッケージを、開発環境やステージング環境など、複数の環境へ配置する。ビルドしたアプリケーションは、統合テストと性能テストを受ける。最後に、本番環境へ配置し、最終利用者が使えるようにする。

attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license · CC BY 4.0 · Source出典
Figure 12.17 A DevOps pipeline is used for a cloud-native app as its microservices code updates move through it. (attribution: Copyright Rice University, OpenStax, under CC BY 4.0 license)
図12.17 マイクロサービスのコード更新が、クラウドネイティブアプリ用のDevOpsパイプラインを通って進む。(出典:Copyright Rice University, OpenStax、CC BY 4.0ライセンス)