AWS: EKS - 4

EKS - Part 4

VPC Tagging

  • Key: The value matches your Amazon EKS cluster’s name.
  • Value: The shared value allows more than one cluster to use this VPC.
Key Value<cluster-name> shared

Load Balancing

Amazon EKS supports the Network Load Balancer and the Classic Load Balancer for pods running on Amazon EC2 instance worker nodes through the Kubernetes service of type LoadBalancer. Classic Load Balancers and Network Load Balancers are not supported for pods running on AWS Fargate (Fargate).

  • All subnets (public and private) should have this tag.
Key Value<cluster-name> shared
  • Public subnet tagging
Key Value 1
  • Private subnet tagging
Key Value 1

ALB Ingress Controller

The AWS ALB Ingress Controller for Kubernetes is a controller that triggers the creation of an Application Load Balancer (ALB) and the necessary supporting AWS resources whenever an Ingress resource is created on the cluster with the alb annotation. The Ingress resource configures the ALB to route HTTP or HTTPS traffic to different pods within the cluster. The ALB Ingress Controller is supported for production workloads running on Amazon EKS clusters.

  • To ensure that your Ingress objects use the ALB Ingress Controller, add the following annotation to your Ingress specification.

    annotations: alb
  • Create an IAM OIDC provider and associate it with your cluster.

    eksctl utils associate-iam-oidc-provider \
        --region  ${REGION_CODE}   \
        --cluster  ${CLUSTER_NAME}  \
  • Create an IAM policy called ALBIngressControllerIAMPolicy for the ALB Ingress Controller pod that allows it to make calls to AWS APIs on your behalf.

    aws iam create-policy \
        --policy-name ALBIngressControllerIAMPolicy \
  • Create a Kubernetes service account named alb-ingress-controller in the kube-system namespace, a cluster role, and a cluster role binding for the ALB Ingress Controller to use with the following command.

    kubectl apply -f
  • Create an IAM role for the ALB ingress controller and attach the role to the service account created in the previous step.

    eksctl create iamserviceaccount \
        --region ${REGION_CODE} \
        --name alb-ingress-controller \
        --namespace kube-system \
        --cluster ${CLUSTER_NAME}  \
        --attach-policy-arn arn:aws:iam::202756970286:policy/ALBIngressControllerIAMPolicy \
        --override-existing-serviceaccounts \
  • Deploy the ALB Ingress Controller

    kubectl apply -f
    kubectl get clusterroles | grep aws-alb-ingress-controller
  • Add a line for the cluster name after the –ingress-class=alb line.

    - args:
        - --ingress-class=alb
        - --cluster-name=prod
        - --aws-vpc-id=vpc-03468a8157edca5bd
        - --aws-region=region-code
  • Log the ingress controller

    kubectl logs -n kube-system   deployment.apps/alb-ingress-controller
  • Deploy a sample application

    kubectl apply -f
    kubectl apply -f
    kubectl apply -f
    kubectl apply -f
  • Play the game on browser