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:
- DNS finds out where the shop lives, like looking up an address.
- The browser connects to the load balancer (ALB) at that address.
- The ALB shows a certificate, an ID card proving "I really am shop.example.com."
- Browser and ALB do a TLS handshake and agree on secret keys, so everything after that is encrypted.
- The ALB decrypts the request, reads "they want
/checkout," and sends it to the checkout Pod in Kubernetes. - 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.
- ClientHello: "Hi, I want shop.example.com. I can speak TLS 1.2 and 1.3, and here are the encryption methods I support."
- ServerHello: "Let's use TLS 1.3. Here's my certificate, and here's what we need to set up encryption."
-
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. - Both sides create shared session keys: temporary secret keys for this one conversation.
- 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.comfrom 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):
- Certificate Manager โ Request a public certificate
- Type your domain name(s)
- Choose DNS validation
- ACM gives you a special CNAME record, a kind of secret code
- Add that record to your DNS
- 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:
- DNS says "shop.example.com is that ALB."
- The browser connects to the ALB on port 443.
- In the TLS handshake, the ALB shows the ACM certificate.
- The ALB decrypts the request. This is TLS termination: the encryption ends here.
- Now it can read
Host = shop.example.com,Path = /checkout. - It matches a routing rule.
- 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
/checkouttocheckout-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:
- asks Let's Encrypt (or another CA) for a certificate
- proves you own the domain
- gets the certificate
- stores it in a Kubernetes Secret with two parts:
-
tls.crt= the certificate -
tls.key= the private key, so protect that Secret
-
- lets the gateway read that Secret and use it
- 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-fullmeans 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.comwith 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 ineu-central-1too.
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
shoppingnamespace.
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 isinternal.) -
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.comnow 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,TLSRouteandTCPRoute.HTTPRoutedoes 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?"
- Domain and DNS are managed in Route 53.
- A public certificate comes from ACM, validated by DNS.
- The AWS Load Balancer Controller turns our Ingress into an ALB.
- The ACM certificate is attached to the 443 listener.
- An HTTP โ HTTPS redirect means nobody stays on plain HTTP.
- Host/path routing sends traffic to the right microservice.
- The ALB terminates TLS. Where needed, it uses HTTPS to the Pods too.
- Internal services talk over TLS or mTLS (service mesh).
- ACM auto-renews. We monitor expiry and make sure apps reload any certificates they use.
19. The five things to really remember
- ACM โ cert-manager. ACM handles certificates for AWS resources. cert-manager handles certificates inside Kubernetes.
- ALB โ NLB. The ALB reads HTTP and routes by host/path. The NLB only handles connections.
- Termination decides where the encryption ends. HTTPS to the ALB does not mean HTTPS to the Pod.
- HTTPS โ fully secure. You also need internal TLS, database TLS, WAF, network rules, encryption at rest and proper password hashing.
- 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
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.