π Kubernetes Ingress + Let's Encrypt TLS Setup (Banking App)¶
This guide explains how to secure your Kubernetes Banking App using:
- Ingress: To expose HTTP/HTTPS services to the outside world
- Cert-Manager: For automatic TLS certificate management via Letβs Encrypt
πͺ Part 1: Ingress β Entry Point for Your App¶
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: bankapp-ingress
π Purpose:¶
Defines an Ingress resource to route external traffic to internal Kubernetes services (like bankapp-service).
π§ Annotations Explained:¶
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
letsencrypt-prod ClusterIssuer. nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/rewrite-target: /
/login to / for backend services expecting root path. nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
π Routing Rules¶
spec:
ingressClassName: nginx
rules:
- host: www.ibtisam-iq.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: bankapp-service
port:
number: 80
This means:
If a request comes to
www.ibtisam-iq.com/(or any path under it), route it tobankapp-serviceon port80.
π TLS Configuration¶
tls:
- hosts:
- www.ibtisam-iq.com
secretName: ibtisamx-tls
- Enables HTTPS for the domain
- TLS cert and private key are stored in a secret named
ibtisamx-tls cert-managerauto-creates this secret after issuing the cert
π Part 2: ClusterIssuer β TLS Certificate Provider Setup¶
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
π Purpose:¶
A ClusterIssuer instructs cert-manager how to request certificates from Letβs Encrypt for entire cluster.
π§ ACME Settings¶
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
- Production endpoint of Letβs Encrypt
π‘ For testing, use:
https://acme-staging-v02.api.letsencrypt.org/directory
email: muhammad@ibtisam-iq.com
- Email used by Letβs Encrypt for expiry and renewal notifications
privateKeySecretRef:
name: letsencrypt-prod
- Secret to store the ACME account private key
π Solver: HTTP-01 Challenge¶
solvers:
- http01:
ingress:
class: nginx
- Uses HTTP-01 challenge
- Letβs Encrypt hits a special HTTP endpoint
- NGINX Ingress must respond with the challenge
- Once verified, cert is issued and stored
π Visual Flow¶
User β www.ibtisam-iq.com (Ingress)
β Cert-Manager handles cert issuance via HTTP-01
β TLS secret (ibtisamx-tls) is created
β Ingress uses this secret to terminate HTTPS
β Traffic forwarded to bankapp-service:80
π§ Why This Setup?¶
β
Automatic HTTPS via Letβs Encrypt
β
Path-based routing with Ingress
β
TLS certificate renewal is automatic
β
Public access with strong encryption and central control
Would you like to extend this guide with:
- YAML manifest breakdown for
bankapp-service? - Self-signed cert fallback?
- Ingress class-based routing for multi-domain apps?