サンプルアプリケーションとして、2048 gameをデプロイします。
ここでは、あらかじめ用意されたサンプル yaml を使用して、以下の kubernetes オブジェクトを作成します。
その後、ALB Ingress Controller を作成し、Ingress オブジェクトとして ALB を作成します。
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.8/docs/examples/2048/2048-namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.8/docs/examples/2048/2048-deployment.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/aws-alb-ingress-controller/v1.1.8/docs/examples/2048/2048-service.yaml
以下のコマンドで、デプロイが完了したことを確認します。
kubectl -n 2048-game rollout status deployment 2048-deployment
Output:
以下のコマンドで、EKS クラスターの Node を確認します。
kubectl get nodes
Output:
NAME STATUS ROLES AGE VERSION
fargate-ip-192-168-112-213.us-east-2.compute.internal Ready <none> 7m34s v1.16.8-eks-e16311
fargate-ip-192-168-116-87.us-east-2.compute.internal Ready <none> 7m9s v1.16.8-eks-e16311
fargate-ip-192-168-150-90.us-east-2.compute.internal Ready <none> 7m19s v1.16.8-eks-e16311
fargate-ip-192-168-175-50.us-east-2.compute.internal Ready <none> 7m42s v1.16.8-eks-e16311
fargate-ip-192-168-182-105.us-east-2.compute.internal Ready <none> 7m41s v1.16.8-eks-e16311
ip-192-168-35-11.us-east-2.compute.internal Ready <none> 22h v1.16.8-eks-fd1ea7
ip-192-168-65-174.us-east-2.compute.internal Ready <none> 22h v1.16.8-eks-fd1ea7
ip-192-168-9-6.us-east-2.compute.internal Ready <none> 22h v1.16.8-eks-fd1ea7
EKS クラスターに Worker Node(EC2) がある場合、ip- で始まる名前でリストアップされます。 Fargate Node の場合は、 fargate- で始まる名前でリストアップされます。
この場合は、5つのFargate Node が ESK クラスターに登録されていることが分かります。
以下のコマンドで、namespace: 2048-game 上にデプロイした Pods を確認します
kubectl get pods -n 2048-game -o wide
5つの Pod が起動していること、そして、それぞれ異なる Fargate Node で起動していることが分かります。
Output:
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
2048-deployment-dd74cc68d-542w5 1/1 Running 0 4m47s 192.168.132.226 fargate-ip-192-168-132-226.us-west-2.compute.internal <none> <none>
2048-deployment-dd74cc68d-5tcmn 1/1 Running 0 4m47s 192.168.101.34 fargate-ip-192-168-101-34.us-west-2.compute.internal <none> <none>
2048-deployment-dd74cc68d-k64bl 1/1 Running 0 4m47s 192.168.170.229 fargate-ip-192-168-170-229.us-west-2.compute.internal <none> <none>
2048-deployment-dd74cc68d-nk9m6 1/1 Running 0 4m47s 192.168.144.7 fargate-ip-192-168-144-7.us-west-2.compute.internal <none> <none>
2048-deployment-dd74cc68d-zrkwg 1/1 Running 0 4m47s 192.168.153.22 fargate-ip-192-168-153-22.us-west-2.compute.internal <none> <none>