AmazonEKSのAutoModeでALBを利用する際の注意点

2025/01/22に公開

概要

EKSClusterをAWSコンソールから作成して、ingressを作成しようとしたところ下記のエラーとなってALBが作成されなかった。

failed load groupID due to ingressClass 'alb' not found: IngressClass.networking.k8s.io "alb" not found

公式ドキュメントがあるのでその通りに進めてみる。
https://docs.aws.amazon.com/ja_jp/eks/latest/userguide/auto-configure-alb.html

下記3を作成するmanifestとなる。Ingress以外は特に個別にパラメータを変更するような箇所は無さそうなので公式ドキュメントのコピペで良さそう。

  • IngressClassParams
  • IngressClass
  • Ingress
---
apiVersion: eks.amazonaws.com/v1
kind: IngressClassParams
metadata:
  name: alb
spec:
  scheme: internet-facing
---
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  name: alb
  annotations:
    # Use this annotation to set an IngressClass as Default
    # If an Ingress doesn't specify a class, it will use the Default
    ingressclass.kubernetes.io/is-default-class: "true"
spec:
  # Configures the IngressClass to use EKS Auto Mode
  controller: eks.amazonaws.com/alb
  parameters:
    apiGroup: eks.amazonaws.com
    kind: IngressClassParams
    # Use the name of the IngressClassParams set in the previous step
    name: alb
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
spec:
  ingressClassName: alb
  rules:
    - http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: service
                port:
                  number: 80

無事に作成された。
pod一覧にはもちろんAWS LB ControllerはいないのでAWS管理になっていることがわかる。

AutoModeではない場合、helmなどを使ってインストールするとingressClassやingressClassParamsはcharts内に存在するので意識しなくても良かったが、AutoModeの時は意識して追加が必要な場合とそうじゃない場合がありそうである。

Discussion