ALB Ingress Controller のデプロイ

Helm を利用した ALB Ingress Controller のデプロイ

本ハンズオンでは、Helm を利用して、ALB Ingress Controller をデプロイします

まず、helm の incubator repository を追加します

helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator

次に、namespace: 2048-game 上に、ALB Ingress Controller をデプロイします

# Get the VPC ID
export VPC_ID=$(aws eks describe-cluster --name eksworkshop-eksctl --query "cluster.resourcesVpcConfig.vpcId" --output text)


helm --namespace 2048-game install 2048-game \
  incubator/aws-alb-ingress-controller \
  --set image.tag=${ALB_INGRESS_VERSION} \
  --set awsRegion=${AWS_REGION} \
  --set awsVpcID=${VPC_ID} \
  --set rbac.create=false \
  --set rbac.serviceAccount.name=alb-ingress-controller \
  --set clusterName=eksworkshop-eksctl

既に作成した Fargte profile で namespace: 2048-game 上の Pod は Fargate Node で起動する設定になっているため、ALB Ingress Controller Pod は Fargate Node として起動します。

次のコマンドを実行し、deploy が完了するまで待ちます

kubectl -n 2048-game rollout status \
  deployment 2048-game-aws-alb-ingress-controller

Output:


Waiting for deployment "2048-game-aws-alb-ingress-controller" rollout to finish: 0 of 1 updated replicas are available...
deployment "2048-game-aws-alb-ingress-controller" successfully rolled out

Pods の確認

次のコマンドで、デプロイした Pods を確認します。

kubectl get pods -n 2048-game

Output:


NAME                                                    READY   STATUS    RESTARTS   AGE
2048-deployment-7f77b47f7-fvrqj                         1/1     Running   0          17m
2048-deployment-7f77b47f7-pvjpk                         1/1     Running   0          17m
2048-deployment-7f77b47f7-pvlmv                         1/1     Running   0          17m
2048-deployment-7f77b47f7-q66n9                         1/1     Running   0          17m
2048-deployment-7f77b47f7-x6sjc                         1/1     Running   0          17m
2048-game-aws-alb-ingress-controller-569d6cbfc8-nfh6c   1/1     Running   0          69s

  • 2048 gameのアプリケーション用 Pod は 2048-deployment- で始まる名前です
  • ALB Ingress Controller用 Pod は 2048-game-aws-alb-ingress-controller- で始まる名前です

Service の確認

次のコマンドで、デプロイした Service の確認を行います

kubectl get svc -n 2048-game

Service は NodePort として作成されており、外部公開されていないことが分かります

NAME           TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
service-2048   NodePort   10.100.22.173   <none>        80:30805/TCP   18m

これで、 ALB ingress controler の作成が終わりました。 ALB ingress controler 用の Pod には、ALBの操作権限が付加された IAM Role が関連付けられています。

次に、 Ingress オブジェクトを作成し、ALB を作成し、2048 game アプリケーションを外部公開します。