Dev.to Security ๐Ÿ” Cybersecurity ๐Ÿ‘ 0 ๐Ÿ“– 17 min read

HTTPS on EKS, Explained Simply: Certificates, ALB vs NLB, TLS Termination and mTLS

HTTPS on EKS, explained simply Certificates, ALB vs NLB, TLS termination and mTLS, in plain English. This is the theory half of a hands-on repo. The practice half is 10 mini projects, listed at the end, each with a sc

HTTPS on EKS, explained simply

Certificates, ALB vs NLB, TLS termination and mTLS, in plain English.

This is the theory half of a hands-on repo. The practice half is 10 mini projects, listed at the end, each with a scenario, the concepts, an implementation guide and a "prove it / break it" drill.

Repo: https://github.com/nazmur96/eks-https-tls-labs

0. The big picture first

When a customer types https://shop.example.com/checkout, this happens in order:

  1. DNS finds out where the shop lives, like looking up an address.
  2. The browser connects to the load balancer (ALB) at that address.
  3. The ALB shows a certificate, an ID card proving "I really am shop.example.com."
  4. Browser and ALB do a TLS handshake and agree on secret keys, so everything after that is encrypted.
  5. The ALB decrypts the request, reads "they want /checkout," and sends it to the checkout Pod in Kubernetes.
  6. The checkout app does its work and replies.

Every tool here has one job in that chain:

Tool Job
Route 53 The address book (DNS)
ACM Gets and renews the ID card (certificate)
ALB The front door, plus the receptionist who reads the request and sends it to the right room
EKS / Kubernetes Where the apps actually run
AWS Load Balancer Controller The worker who builds the front door from your Kubernetes instructions
cert-manager Like ACM, but for certificates inside Kubernetes

Keep this picture in mind. Everything below zooms in on one piece of it.

1. Why do we need HTTPS at all?

Picture logging in and typing your password and credit card number. With plain HTTP, that data crosses the internet in readable form. Anyone in between can read it, for example someone on the same cafรฉ Wi-Fi.

  • HTTP is a postcard. Every postman who handles it can read it.
  • HTTPS is a locked box. Only the right person can open it.

HTTPS gives you three guarantees:

  • Encryption: nobody else can read it.
  • Authentication: you know you're talking to the real shop, not a fake.
  • Integrity: nobody can secretly change the message on the way.

Names to untangle:

  • HTTPS = normal HTTP + TLS protection.
  • TLS = the security protocol doing the actual work.
  • SSL = the old, outdated version of TLS. It's dead, but people still say "SSL certificate" out of habit. They mean a TLS certificate.

2. What is a certificate?

A certificate is a digital ID card for a website. Before you trust a bank, you want proof it really is the bank. Websites have the same problem.

A certificate contains:

  • the domain it belongs to (shop.example.com)
  • a public key (more on this in section 3)
  • valid-from and valid-until dates
  • who issued it
  • a signature from the issuer, like an official stamp

The browser checks it. If the name matches, the dates are fine and the issuer is trusted, the browser trusts the site.

Who issues certificates? A Certificate Authority (CA). Think of a CA as a passport office. It checks that you really own the domain, then issues the ID card. Examples are Let's Encrypt (free), DigiCert, GlobalSign, and Amazon through ACM. Your browser ships with a built-in list of CAs it trusts, which is why it believes their stamp.

3. Public key and private key

Certificates use two keys that work as a pair:

  • Public key: anyone can see it. It's printed inside the certificate.
  • Private key: secret. Only the server, or whatever system handles the encryption, has it.

Analogy: a special mailbox. Anyone can use the public slot, but only the owner holds the key that proves "this mailbox is mine."

So having the public key doesn't let anyone pretend to be the site. That takes the private key, which means a leaked private key lets someone impersonate your website.

Golden rule: never put a private key in GitHub, a Docker image or a config file in your repo. This matters in Kubernetes, because certificate Secrets contain the private key.

4. The TLS handshake

Before any real data is sent, browser and server have a quick setup conversation, like two people agreeing on a secret language before talking privately.

  1. ClientHello: "Hi, I want shop.example.com. I can speak TLS 1.2 and 1.3, and here are the encryption methods I support."
  2. ServerHello: "Let's use TLS 1.3. Here's my certificate, and here's what we need to set up encryption."
  3. The browser checks the certificate. Was it issued by a trusted CA? Has it expired? Does it match shop.example.com? Is the chain of trust valid, meaning it was signed by a trusted CA, possibly through an intermediate CA? If anything fails, you get the scary "Your connection is not private" warning.
  4. Both sides create shared session keys: temporary secret keys for this one conversation.
  5. Real traffic starts. Passwords, cart and payment are all encrypted.

One subtle point: the private key does not encrypt all your data. It's used during the handshake to prove identity and to help agree safely on session keys. The data itself is then encrypted with those fast, temporary session keys.

5. Domain registration vs DNS

People mix these two up.

  • Domain registration = buying the name. You buy example.com from a registrar (Route 53, Cloudflare, GoDaddy...). It's like buying the right to use a shop name.
  • DNS = the address book of the internet. When someone asks "where is shop.example.com?", DNS answers. Route 53 can do this, and so can Cloudflare and others. You can buy the domain in one place and run DNS somewhere else.

Connecting your domain to the ALB: AWS gives your ALB an ugly name like k8s-shop-123456.eu-central-1.elb.amazonaws.com. You create a DNS record, shop.example.com โ†’ A record (Alias) โ†’ your ALB. Customers type the nice name and land on the ALB.

Piece Job
Registrar Sells you the name
DNS Tells browsers where the name points
ACM Gives you the certificate (ID card)
ALB Receives and routes the traffic

DNS says where to go. The certificate proves who you're talking to once you arrive. One doesn't replace the other.

6. AWS Certificate Manager (ACM)

The problem without ACM: imagine 50 websites, each needing a certificate. For every one you'd get it from a CA, store the private key safely, install it, watch the expiry date, renew it and reinstall it. Forget one and that site breaks.

What ACM does for you:

  • requests the certificate
  • checks that you own the domain
  • attaches it to AWS services such as the ALB
  • renews it automatically
  • keeps the private key hidden. You never download it, so you can't leak it.

Covering many names: one certificate can list several names (example.com, shop.example.com, api.example.com), or use a wildcard: *.example.com covers shop., api., admin. and so on.

โš ๏ธ A wildcard does not cover the bare example.com. Add it separately if you need it.

How to request one (console):

  1. Certificate Manager โ†’ Request a public certificate
  2. Type your domain name(s)
  3. Choose DNS validation
  4. ACM gives you a special CNAME record, a kind of secret code
  5. Add that record to your DNS
  6. ACM sees it and concludes "only the domain owner could add this." The certificate is issued.

Why DNS validation is recommended: if you leave that CNAME in place, ACM can re-check ownership by itself and renew automatically, indefinitely.

Remember: ACM does not sell domains. It only handles certificates for domains you already control.

7. Layer 4 vs Layer 7, and ALB vs NLB

This one is a classic interview topic.

  • Layer 4 only knows the envelope: IP address, port and protocol (TCP/UDP). "Deliver this to 10.0.1.25, port 443."
  • Layer 7 reads the letter inside: the actual HTTP request. "Host = shop.example.com, Path = /checkout, Method = POST."

Analogy: a delivery to an office building. Layer 4 is the security guard who only checks "right building, right floor?" Layer 7 is the receptionist who reads the letter, says "ah, this is for the checkout team," and walks it to the right desk.

ALB (Application Load Balancer) = Layer 7. It understands HTTP and HTTPS, routes by host and URL path, and is the best fit for web apps and microservices.

NLB (Network Load Balancer) = Layer 4. It handles raw connections (TCP/UDP/TLS) and is very fast and very simple. It cannot look at URLs or host headers. Use it for non-HTTP traffic (databases, game servers, custom protocols), or in front of your own proxy.

Feature ALB NLB
Layer 7 4
Reads HTTP paths and hosts โœ… โŒ
Raw TCP/UDP โŒ โœ…
Can terminate TLS โœ… โœ… (TLS listener)
Can pass TLS through untouched โŒ โœ… (TCP listener)

An important correction: an NLB does NOT give you Layer 7 protection. Supporting TLS โ‰  understanding HTTP โ‰  blocking attacks. Those are three separate things:

  • TLS = encryption
  • ALB = HTTP routing
  • AWS WAF = actually inspects and blocks malicious web requests

8. How the ALB routes traffic

Goal: one ALB for many services, instead of paying for a separate load balancer per service.

Host-based routing decides by domain name:

  • shop.example.com โ†’ frontend
  • api.example.com โ†’ API service
  • admin.example.com โ†’ admin service

All three names point at the same ALB. It reads the Host header and decides.

Path-based routing decides by URL path:

  • shop.example.com/ โ†’ frontend
  • shop.example.com/checkout โ†’ checkout service
  • shop.example.com/payment โ†’ payment service

You can combine both in one ALB:

  • "If host is shop.example.com AND path is /checkout โ†’ checkout"
  • "If host is api.example.com AND path is /payments โ†’ payment"

The ALB can only do this because it works at Layer 7 and can read the request.

๐Ÿ‘‰ Practise it: Lab 1: One ALB, many services

9. Where the certificate fits on the ALB, and what "TLS termination" means

Following the customer to https://shop.example.com/checkout:

  1. DNS says "shop.example.com is that ALB."
  2. The browser connects to the ALB on port 443.
  3. In the TLS handshake, the ALB shows the ACM certificate.
  4. The ALB decrypts the request. This is TLS termination: the encryption ends here.
  5. Now it can read Host = shop.example.com, Path = /checkout.
  6. It matches a routing rule.
  7. It forwards the request to the checkout Pods, using their IP addresses directly.
Browser โ”€โ”€HTTPS (encrypted)โ”€โ”€โ–บ ALB โ”€โ”€HTTP (plain)โ”€โ”€โ–บ Checkout Pod
                           [decrypts here]

TLS termination = the place where the locked box gets opened. It has to happen at the ALB, because the ALB can't read paths inside a locked box.

The catch:

  • Browser โ†’ ALB is encrypted โœ…
  • ALB โ†’ Pod is plain HTTP in this setup โŒ

This is common, but it is not end-to-end encryption. "It's inside our private VPC" doesn't mean it's encrypted.

The fix is to re-encrypt to the backend. Set the ALB target group to HTTPS, and you get two separate TLS connections:

Browser โ‡„ ALB   (TLS connection 1, ACM certificate)
ALB โ‡„ Pod       (TLS connection 2, the Pod's own certificate)

The ALB still opens the box briefly to read it, then locks it again before sending it on.

๐Ÿ‘‰ Practise it: Lab 2: Where does the lock open?

10. Where Kubernetes fits in

Your cluster has three apps (frontend, checkout, payment), each with a Deployment and a Service. You need a front door from the internet into the cluster.

Two terms people confuse:

  • Ingress = a Kubernetes object containing routing rules, like an instruction sheet ("send /checkout to checkout-svc").
  • Ingress Controller = the thing that reads the instruction sheet and makes it real.

An Ingress on its own does nothing. Without a controller, it's a note nobody reads.

The AWS Load Balancer Controller runs inside EKS and watches your Kubernetes objects:

You write in Kubernetes AWS creates
kind: Ingress ALB
Service with type: LoadBalancer NLB

It also creates the routing rules and registers your Pod IPs as targets. You never click around the console building the ALB: you write YAML and the controller builds it.

๐Ÿ‘‰ Practise it: Lab 3: Controller detective

11. cert-manager, and how it differs from ACM

cert-manager runs inside Kubernetes and does for workloads in the cluster what ACM does for AWS resources.

Example: you run an in-cluster gateway that needs its own certificate. cert-manager:

  1. asks Let's Encrypt (or another CA) for a certificate
  2. proves you own the domain
  3. gets the certificate
  4. stores it in a Kubernetes Secret with two parts:
    • tls.crt = the certificate
    • tls.key = the private key, so protect that Secret
  5. lets the gateway read that Secret and use it
  6. renews the certificate before it expires
ACM cert-manager
Lives in AWS Kubernetes
Used for ALB / NLB / AWS services Things inside the cluster
Private key Hidden by AWS; you never touch it Stored in a Kubernetes Secret
Typical CA Amazon Let's Encrypt, Vault, a private CA

Two typical setups:

  • Setup A: ALB + ACM (the main one). The certificate lives in ACM and is attached to the ALB. You don't need cert-manager just to get HTTPS on an ALB.
  • Setup B: NLB + in-cluster gateway + cert-manager. The NLB passes the encrypted traffic through. The gateway in the cluster decrypts it with a cert-manager certificate and does the host/path routing, since the NLB can't.

๐Ÿ‘‰ Practise it: Lab 4: Two certificate managers

12. NLB and TLS: two ways to handle encryption

Option A: the NLB terminates TLS

  • Listener type TLS, port 443, with an ACM certificate.
  • The NLB opens the box and sends decrypted traffic to the backend.
  • Optionally it re-encrypts to the backend (a TLS target group, which is a second connection).
  • It still can't route by URL. It only handles the connection.

Option B: TLS passthrough

  • Listener type TCP, port 443. Note: TCP, not TLS.
  • The NLB never opens the box. It forwards the encrypted bytes unchanged.
  • Your gateway inside the cluster decrypts them with a cert-manager certificate.
  • Use this when the rule is "the load balancer must not see our decrypted traffic."
You want... Use
AWS to handle public HTTPS + URL routing ALB + ACM
The NLB to handle public TLS NLB TLS listener + ACM
Your own proxy to receive the original encrypted traffic NLB TCP listener (passthrough)
Routing by host/path ALB, or a Layer 7 proxy/gateway in the cluster
Encryption to the backend too HTTPS/TLS on the backend connection

Lesson: TLS termination and Layer 7 routing are different things.

๐Ÿ‘‰ Practise it: Lab 5: NLB two ways

13. Encryption inside the system

So far we've only protected customer โ†’ load balancer. Inside the cluster, traffic goes frontend โ†’ checkout โ†’ payment โ†’ database. If all of that is plain text, an attacker who gets into the network or takes over one Pod can listen in.

The layers of protection:

  • A. Customer โ†’ ALB: HTTPS with the ACM certificate.
  • B. ALB โ†’ Pod: an HTTPS target group (re-encryption).
  • C. Pod โ†’ Pod: services talk over TLS. Big systems use a service mesh (Istio, Linkerd), so you don't configure TLS in every app by hand.
  • D. App โ†’ Database: require TLS on PostgreSQL. sslmode=verify-full means encrypt and check the database's certificate and hostname, so you know it's the real database. For RDS, AWS publishes the CA certificate your app uses to verify it.
  • E. Application-level encryption: the app encrypts sensitive fields (for example payment references) before saving them, using keys from AWS KMS.

What is mTLS (mutual TLS)?

  • Normal TLS: only the server shows an ID card. The browser checks the website, but the website doesn't check a certificate from the browser.
  • mTLS: both sides show ID cards and check each other. When frontend calls checkout, frontend checks "are you really checkout?" and checkout checks "are you really frontend?" A hacked Pod can't just claim to be checkout; it has to prove it. Service meshes make this automatic.

Three kinds of encryption. Don't mix them up:

Type Protects data... Example
In transit While it travels HTTPS, Pod-to-Pod TLS
At rest While it's stored on disk Encrypted RDS, encrypted EBS
Application-level Specific fields, even inside the DB Card references encrypted with KMS

Passwords are different: hash them, don't encrypt them.

  • Encryption is reversible with the key.
  • Hashing is one-way: you can't get the original back, you only compare hashes at login.
  • Use Argon2id or bcrypt.

Big takeaway: "We use TLS, so we're secure" is wrong. TLS is one layer among many.

๐Ÿ‘‰ Practise it: Lab 6: mTLS ยท Lab 7: database TLS ยท Lab 8: app-level encryption

14. Certificate rotation (expiry)

Every certificate has an expiry date. If it expires, you get browser warnings and failed connections, and a perfectly healthy app looks dead to customers. Replacing it before expiry is called renewal or rotation.

ACM rotation (easy mode): ACM notices that expiry is getting close, re-checks ownership through the DNS record you left in place, issues the renewed certificate and puts it on the ALB. You do nothing.

Two conditions apply:

  • the DNS validation record must still exist
  • the certificate must be eligible for managed renewal

โš ๏ธ ACM won't renew a certificate you imported from another company. You renew it with that company and re-import it yourself.

cert-manager rotation has one extra trap. cert-manager watches the expiry date, requests a new certificate in time and updates the Kubernetes Secret. The app might not notice. Some apps watch the file and reload automatically. Others only read the certificate at startup, so they keep serving the old one until they're restarted.

Fix: restart the Pods, or use a "reloader" tool that restarts them whenever the Secret changes.

๐Ÿ‘‰ Practise it: Lab 9: Certificate fire drill

15. Building the project, step by step

Phase 1: Domain

  • Buy example.com.
  • Create a hosted zone in Route 53.
  • If you bought the domain elsewhere, point its nameservers at Route 53.

Phase 2: Certificate

  • In ACM, request a public certificate for shop.example.com with DNS validation.
  • Add the CNAME and wait for Issued.
  • Copy the certificate ARN (its unique AWS ID).

โš ๏ธ ACM certificates are regional. If your ALB is in Frankfurt (eu-central-1), the certificate must be in eu-central-1 too.

Phase 3: EKS

  • Create the cluster.
  • Install the AWS Load Balancer Controller, with IAM permissions that allow it to create ALBs.
  • Deploy frontend, checkout and payment (Deployments + Services) in a shopping namespace.

Phase 4: the Ingress (the key file)

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: shopping
  namespace: shopping
  annotations:
    alb.ingress.kubernetes.io/scheme: internet-facing
    alb.ingress.kubernetes.io/target-type: ip
    alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]'
    alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:eu-central-1:111122223333:certificate/...
    alb.ingress.kubernetes.io/ssl-redirect: '443'
spec:
  ingressClassName: alb
  rules:
    - host: shop.example.com
      http:
        paths:
          - { path: /checkout, pathType: Prefix, backend: { service: { name: checkout-svc, port: { number: 80 } } } }
          - { path: /payment,  pathType: Prefix, backend: { service: { name: payment-svc,  port: { number: 80 } } } }
          - { path: /,         pathType: Prefix, backend: { service: { name: frontend-svc, port: { number: 80 } } } }

What each line means:

  • ingressClassName: alb โ†’ "AWS Load Balancer Controller, this one's yours."
  • scheme: internet-facing โ†’ a public ALB, reachable from the internet. (The default is internal.)
  • target-type: ip โ†’ send traffic straight to Pod IPs.
  • listen-ports โ†’ open both doors, 80 and 443.
  • certificate-arn โ†’ attach the ACM certificate to port 443.
  • ssl-redirect: '443' โ†’ anyone on plain HTTP gets pushed to HTTPS.
  • The rules: /checkout โ†’ checkout, /payment โ†’ payment, and / โ†’ frontend as the catch-all.

Run kubectl apply -f shopping-ingress.yaml and the controller builds an ALB with listeners on 80 and 443, the ACM certificate on 443, one target group each for frontend, checkout and payment, and the routing rules and Pod IP registrations.

Phase 5: DNS

  • Find the ALB's DNS name.
  • In Route 53, create an A record (Alias): shop.example.com โ†’ the ALB.
  • https://shop.example.com now works end to end.

16. Gateway API (the newer way)

  • Ingress = older and simpler, mostly basic HTTP routing rules.
  • Gateway API = the newer, more capable successor. It covers HTTP, TCP, TLS and service-mesh cases, and separates cleanly who owns what. Its objects are GatewayClass, Gateway, HTTPRoute, TLSRoute and TCPRoute. HTTPRoute does the same host/path matching as Ingress rules.

News worth knowing: the community ingress-nginx controller was retired in March 2026. It still runs but gets no security fixes, so don't start new production projects on it. Use the AWS Load Balancer Controller, another maintained controller, or a Gateway API implementation. The Ingress API itself is not retired. Only that one popular controller is.

17. Other security pieces: who does what

Tool Simple job
ACM Manages certificates
TLS Encrypts and proves identity
ALB Routes HTTP requests
NLB Routes network connections
AWS WAF Reads requests and blocks malicious ones (attached to the ALB)
Security Groups Firewall around each AWS resource
Network ACL Firewall at the subnet level
K8s NetworkPolicy Firewall between Pods ("frontend may talk to checkout, not to the DB")
KMS Stores and manages encryption keys
Service mesh Automatic mTLS between services

Example: an attacker sends a malicious login request over HTTPS. TLS faithfully encrypts it, and encryption doesn't make it safe. The ALB decrypts it, then WAF inspects it and blocks it. That's why you stack several controls.

18. The interview answer, simplified

"How do you do HTTPS and certificates in EKS?"

  1. Domain and DNS are managed in Route 53.
  2. A public certificate comes from ACM, validated by DNS.
  3. The AWS Load Balancer Controller turns our Ingress into an ALB.
  4. The ACM certificate is attached to the 443 listener.
  5. An HTTP โ†’ HTTPS redirect means nobody stays on plain HTTP.
  6. Host/path routing sends traffic to the right microservice.
  7. The ALB terminates TLS. Where needed, it uses HTTPS to the Pods too.
  8. Internal services talk over TLS or mTLS (service mesh).
  9. ACM auto-renews. We monitor expiry and make sure apps reload any certificates they use.

19. The five things to really remember

  1. ACM โ‰  cert-manager. ACM handles certificates for AWS resources. cert-manager handles certificates inside Kubernetes.
  2. ALB โ‰  NLB. The ALB reads HTTP and routes by host/path. The NLB only handles connections.
  3. Termination decides where the encryption ends. HTTPS to the ALB does not mean HTTPS to the Pod.
  4. HTTPS โ‰  fully secure. You also need internal TLS, database TLS, WAF, network rules, encryption at rest and proper password hashing.
  5. Automate certificates. An expired certificate takes down a healthy app.

20. Quick cheat sheet

  • Domain = buying the name
  • DNS / Route 53 = address book
  • Certificate = website ID card
  • CA = passport office that issues the ID cards
  • Private key = the secret that proves you own the ID. Never leak it.
  • TLS handshake = agreeing on a secret language before talking
  • TLS termination = where the locked box gets opened
  • TLS passthrough = forwarding the locked box unopened
  • Ingress = instruction sheet
  • Ingress Controller / AWS LB Controller = the worker who follows the sheet
  • mTLS = both sides show ID
  • WAF = bouncer who checks requests for bad stuff
  • Rotation = swapping certificates before they expire

Practise it: 10 mini projects

Reading this won't make it stick. Each lab below has a scenario and task, the concepts behind it, an implementation guide (steps and key settings, not copy-paste code), and a prove it / break it drill. They focus on sections 8โ€“14.

โ˜๏ธ = needs AWS (costs money while it runs) ยท ๐Ÿ  = free on a local kind/k3d cluster

# Lab Sections Where
0 Lab foundation setup โ˜๏ธ
1 One ALB, many services 8, 10 โ˜๏ธ
2 Where does the lock open? 9 โ˜๏ธ
3 Controller detective 10 โ˜๏ธ
4 Two certificate managers 11 โ˜๏ธ / ๐Ÿ 
5 NLB two ways 12 โ˜๏ธ
6 Zero-trust inside the cluster 13 (mTLS) ๐Ÿ 
7 Lock the database 13 (DB TLS) ๐Ÿ  / โ˜๏ธ
8 Protect the data itself 13 (app-level, hashing) ๐Ÿ  + tiny โ˜๏ธ
9 Certificate fire drill 14 ๐Ÿ  / โ˜๏ธ
10 Capstone everything โ˜๏ธ

Suggested order: first build EKS + ALB + ACM end to end (labs 0โ€“3). Then cert-manager and NLB passthrough (4โ€“5). Then the internal-encryption labs (6โ€“9), most of which run free on kind. Finish with the capstone. Each step builds on the one before.

originally published at https://github.com/nazmur96/eks-https-tls-labs/blob/main/docs/https-on-eks-explained.md

๐Ÿ“ฐ Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ€” full credit and traffic to the original publisher.