linckon / eks-aws-loadbalancer-ingress

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EKS Cluster and AWS Load Balancer Controller Setup

Network Architecture which we are going to deploy

ingress

I use makefile to simplify running Command

A Makefile is a powerful tool that simplifies the process of managing and automating complex tasks in software development and system administration. It serves as a build automation tool that orchestrates the execution of commands to streamline the development, deployment, and maintenance processes.

Before running the Makefile, ensure that you have the following prerequisites:

  • eksctl installed
  • kubectl installed
  • AWS CLI installed and configured
  • Helm installed
  • A valid SSH key pair for SSH access to the nodes
  1. Create EKS Cluster:

    make create_cluster
  2. Deploy Private Node Group:

    make deploy_private_nodegroup
  3. Create OIDC:

    make create_oidc
  4. Create Load Balancer IAM Policy:

    make create_lb_policy
  5. Create Service Account:

    make create_service_account
  6. Install AWS Load Balancer Controller:

    make install_aws_loadbalancer

Deployment kube-manifest

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-nginx-deployment
  labels:
    app: app-nginx
spec:
  replicas: 1
  selector:
    matchLabels:
      app: app-nginx
  template:
    metadata:
      labels:
        app: app-nginx
    spec:
      containers:
        - name: app-nginx
          image: mahmudarif/k-nginx1:2.0
          ports:
            - containerPort: 80

NodePort Service

apiVersion: v1
kind: Service
metadata:
  name: app-nodeport-service
  labels:
    app: app-nginx
  # annotations:
  #  alb.ingress.kubernetes.io/healthcheck-path: /app1/index.html
spec:
  type: NodePort
  selector:
    app: app-nginx
  ports:
    - port: 80
      targetPort: 80 

Ingress Class

apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  name: my-ingress-class
  annotations:
    ingressclass.kubernetes.io/is-default-class: "true"
spec:
  controller: ingress.k8s.aws/alb

Ingress kube-manifest with Default Backend Option

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: eks-ingress
  labels:
    app: app-nginx
  annotations:
    alb.ingress.kubernetes.io/load-balancer-name: my-ingress
    alb.ingress.kubernetes.io/scheme: internet-facing
    
    alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
    alb.ingress.kubernetes.io/healthcheck-port: traffic-port
    alb.ingress.kubernetes.io/healthcheck-path: /app1/index.html
    alb.ingress.kubernetes.io/healthcheck-interval-seconds: '15'
    alb.ingress.kubernetes.io/healthcheck-timeout-seconds: '5'
    alb.ingress.kubernetes.io/success-codes: '200'
    alb.ingress.kubernetes.io/healthy-threshold-count: '2'
    alb.ingress.kubernetes.io/unhealthy-threshold-count: '2'


spec:
  ingressClassName: my-ingress-class
  defaultBackend:
    service:
      name: app-nodeport-service
      port:
        number: 80

Install ingres-class ingress rules node app components

  # Navigate to Directory
  basic-ingress-manifest

  # Deploy IngressClass
  make deploy_ingress_class

  # Deploy Application
  make deploy_app

  # Deploy Ingress Rule
  make deploy_ingres_rule

  # Cleanup Components:
  make cleanup_components

About


Languages

Language:Makefile 100.0%