ツナワタリマイライフ

日常ネタから技術ネタ、音楽ネタまで何でも書きます。

「Principles of Container-based Application Design」読んだ

はじめに

読みました。

blog.kubernetes.io

The Twelve-Factor Appのように、ベストプラクティスというものは知っておくと役に立ちますよね。昨今はコンテナオーケストレーションを使うのが当たり前のようになってくるでしょうから、押さえておきましょう。

12factor.net

Principles of Container-based Application Design

コンテナベースアプリケーション設計の原則

It’s possible nowadays to put almost any application in a container and run it.

最近ではほとんどのアプリケーションがコンテナ上に配置され、動かすことが可能です。

Creating cloud-native applications, however—containerized applications that are automated and orchestrated effectively by a cloud-native platform such as Kubernetes—requires additional effort.

しかし、Kuberenetesのような、クラウドネイティブプラットフォームによって自動配備されるコンテナ化されたアプリケーションを作るときはさらなる努力が必要です。

Cloud-native applications anticipate failure; they run and scale reliably even when their infrastructure experiences outages.

クラウドネイティブアプリケーションは障害を予想します。自身のインフラストラクチャが停止しても確実に実行/拡張します。

To offer such capabilities, cloud-native platforms like Kubernetes impose a set of contracts and constraints on applications.

このような効果を提供するために、kubernetesのようなクラウドネイティブプラットフォームはアプリケーションに一連の制約と契約を課します。

These contracts ensure that applications they run conform to certain constraints and allow the platform to automate application management.

これらの契約は実行するアプリケーションがプラットフォームにアプリケーション管理を自動化させ、制約に適合させることを保証します。

seven principles

7つの原則

buildtimeとruntimeという2つの領域にわけられます。構築時の原則と実行時の原則かな。

Build time

  • Single Concern: Each container addresses a single concern and does it well.

単一の関心:それぞれのコンテナは1つのことをうまくやる(UNIX哲学ですね)

  • Self-Containment: A container relies only on the presence of the Linux kernel. Additional libraries are added when the container is built.

自己完結:コンテナはLinux kernelのみに依存します。追加のライブラリはビルド時に追加されます。

  • Image Immutability: Containerized applications are meant to be immutable, and once built are not expected to change between different environments.

不変イメージ:コンテナアプリケーションは不変であることを意味し、1度ビルドされると異なる環境間での変更は期待されません。

Runtime

  • High Observability: Every container must implement all necessary APIs to help the platform observe and manage the application in the best way possible.

高い可観測性:すべてのコンテナは可能な限りプラットフォームがアプリケーションを管理/観測するために必要なAPIを実装すべきです。

  • Lifecycle Conformance: A container must have a way to read events coming from the platform and conform by reacting to those events.

ライフルサイクルの適合:コンテナはプラットフォームからのイベントを読み取り、イベントに反応して適合するための手段を持つ必要があります。

  • Process Disposability: Containerized applications must be as ephemeral as possible and ready to be replaced by another container instance at any point in time.

プロセス廃棄性:コンテナアプリケーションは可能な限り短命であり、任意に他のコンテナインスタンスを置き換え可能であるべきです。

  • Runtime Confinement: Every container must declare its resource requirements and restrict resource use to the requirements indicated.

実行時制限:すべてのコンテナはリソース要件を宣言し、指定された要件に制約されるべきです。

The build time principles ensure that containers have the right granularity, consistency, and structure in place.

構築時原則はコンテナが正しい粒度、一貫性、構成を確保できていることを保証します。

The runtime principles dictate what functionalities must be implemented in order for containerized applications to possess cloud-native function.

実行時原則はコンテナアプリケーションがクラウドネイティブ機能を所有するために実装されるべき機能を列挙しました。

Adhering to these principles helps ensure that your applications are suitable for automation in Kubernetes.

これらの原則に従うことで、アプリケーションがkubernetesによって自動的に最適化されることを保証します。

おわりに

kubernetesのような自己修復機能を備えたコンテナプラットフォームの上でうまく動くために必要な原則と、コンテナ構築時の原則と、実行時の原則に分けて説明されました。

構築時の原則は単一コンテナであれそもそも必要なことのように感じました。kubernetesで動かすために大事なのは後者の実行時原則ですが、これをどう"適合"させるのか、というのはkubernetesを学ばないとちょっとわからないですね。

今後はkubernetesガンガン触っていこうと思います。

Cloud Native Infrastructure: Patterns for Scalable Infrastructure and Applications in a Dynamic Environment

Cloud Native Infrastructure: Patterns for Scalable Infrastructure and Applications in a Dynamic Environment

読んでないのですが、Cloud Nativeという言葉がでてきたのでこの本も関係あるかな?

入門 Kubernetes (オライリー・ジャパン)

入門 Kubernetes (オライリー・ジャパン)

これは読む予定。

UNIXという考え方―その設計思想と哲学

UNIXという考え方―その設計思想と哲学

これは名著。