rights reserved. Amazon Confidential and Trademark. Kubernetes の概要 10 • 複数のホスト間でコンテナ化されたアプリケーションを 管理するオープンソースシステム • Cloud Native Computing Foundation (CNCF) によって管理、 推進されている • デプロイ、メンテナンス、スケーリング といった基本的な機能を提供している • “Kubernetes is a portable, extensible, open source platform for managing containerized workloads and services, that facilitates both declarative configuration and automation.” https://kubernetes.io/docs/concepts/overview/what-is- kubernetes/ より
rights reserved. Amazon Confidential and Trademark. Pod • 作成、スケジュール、管理できる最小のデプロイ可能な単位 • 1 Pod に複数のコンテナを含む事が可能 例) 1つの Pod にアプリケーションコンテナとログドライバのコンテナを配置 • 同じ Pod 内のコンテナは Volume や Network を共有可能 • Pod 内のコンテナは localhost で通信可能 Nginx PHP-FPMコンテナ Pod localhostで通信 Volumeを共有
rights reserved. Amazon Confidential and Trademark. ReplicaSet • Pod のレプリカを作成し、Pod を指定された数に維持するリソース • Pod が実行中の Worker Node の障害時には、指定された Pod の数を 維持するために影響を受けた Pod を別の Node に再作成する ReplicaSet Pod Pod count=3 Pod Pod Pod
rights reserved. Amazon Confidential and Trademark. Deployment • 複数の ReplicaSet を管理し、Pod のローリングアップデートや ロールバックを実現する為のリソース • ReplicaSet で Pod のローリングアップデートなどの機能が 利用できないため、Deployment の利用が一般的 ReplicaSet Pod Pod Pod count=3 version=2 ReplicaSet Pod Pod Pod count=3 version=1 Deployment 例) version 1 → 2にローリングアップデートする
rights reserved. Amazon Confidential and Trademark. Service • 複数の Pod をネットワーク越しに公開するリソース • Pod に対してトラフィックを流す事ができる(L4ロードバランシング) • Service に IPアドレスを割り当てる事もできる Pod Pod Pod Service L4ロードバランシング
rights reserved. Amazon Confidential and Trademark. Kubernetes のアーキテクチャ(再掲) 22 API Server コントロールプレーン データプレーン Worker Node Worker Node Worker Node コントロールプレーンって大袈裟に書いてるけどこれ is 何?
rights reserved. Amazon Confidential and Trademark. EKS Architecture 25 https://aws.github.io/aws-eks-best-practices/reliability/docs/controlplane/ API Server は 2 AZ, etcd は 3AZ に跨った auto scaling group 上に展開
rights reserved. Amazon Confidential and Trademark. Horizontal Pod Autoscaler (HPA) によるオート スケール • CPU 負荷などメトリクスに応じて Pod のオートスケール を行う • HPA を行うには Kubernetes Metrics Server のインストールが必要 • Fargate の場合は WorkerNode を意識する必要がない WorkerNode AWS Fargate Pod Pod Pod Pod ・・・ Pod ・・・ スケールアウト スケールイン スケールアウト スケールイン
rights reserved. Amazon Confidential and Trademark. Cluster Autoscaler (CA) によるオートスケール • ノードのリソース不足により Pod が起動できない (Pending) → スケールアウト • ノードのリソースに余力があり、別のノードに Pod を再配置可能 Pod Pod Pod Pod Pod Pod Pod Pod Pod Pod
rights reserved. Amazon Confidential and Trademark. Vertical Pod Autoscaler (VPA) • Pod のメモリと CPU の予約サイズを適切なサイズに調整する • 実績に基づいたリソースの調整を自動で行うため、 あらかじめ適切なリソース量を推測しにくい場合に向く • VPA を行うには Kubernetes Metrics Server のインストールが必要 Pod Pod 過去の実績を分析 予約サイズを自動で調整 予約リソース 使用したリソース
rights reserved. Amazon Confidential and Trademark. IAM を用いたクラスターアクセス管理 36 これまで Kubernetes のユーザー/ロールと AWS IAM のマッピングを 考える際に aws-auth ConfigMap を使用していた。このアップデートに より EKS API にアクセス管理用の機能が追加され、この API を通じて IAM プリンシパルによる Kubernetes の権限管理が可能になった。 AWS IAM Authenticator for Kubernetes をコントロールプレーンに インストールすることで実現している この機能がサポートされるプラットフォームバージョンに制限あり: https://docs.aws.amazon.com/eks/latest/userguide/access- entries.html#access-entries-prerequisites https://aws.amazon.com/about-aws/whats-new/2023/12/amazon-eks-controls-iam-cluster-access-management/ https://aws.amazon.com/blogs/containers/a-deep-dive-into-simplified-amazon-eks-access-management-controls/