Complete Ingress Manifest
Location:ingress/ingress.yml
Configuration Overview
Metadata
nginx.ingress.kubernetes.io/rewrite-target: /$2- URL rewriting for path strippingcert-manager.io/cluster-issuer: letsencrypt-prod- Automatic TLS certificate provisioning
Ingress Class
TLS Configuration
TLS Settings
- Hosts: TLS certificate valid for
exchange.jogeshwar.xyz - Secret: Certificate and private key stored in
exchange-tlsSecret - Issuer: Automatically provisioned by cert-manager using Let’s Encrypt
Certificate Management
Thecert-manager.io/cluster-issuer annotation triggers automatic certificate lifecycle management:
-
Initial Provisioning:
- cert-manager detects new Ingress
- Requests certificate from Let’s Encrypt
- Completes ACME challenge (HTTP-01)
- Stores certificate in
exchange-tlsSecret
-
Automatic Renewal:
- Monitors certificate expiration
- Renews 30 days before expiry
- Updates Secret with new certificate
- Zero-downtime renewal
TLS Secret Structure
Path Routing
Backend Router Path
- Pattern:
/backend(/|$)(.*)- Matches/backend,/backend/, and/backend/* - Service: Routes to
exchange-router-serviceon port 80 - Path Type:
ImplementationSpecific- Uses NGINX-specific regex matching - Rewrite: Strips
/backendprefix via annotation
WebSocket Path
- Pattern:
/ws- Exact match for WebSocket endpoint - Service: Routes to
exchange-ws-stream-serviceon port 80 - Path Type:
ImplementationSpecific - Protocol: Supports WebSocket upgrade
URL Rewriting
Rewrite Target Annotation
| Original Request | Capture $2 | Rewritten Path |
|---|---|---|
/backend/api/orders | api/orders | /api/orders |
/backend/health | health | /health |
/backend/ | “ | / |
Why Path Rewriting?
Without Rewrite:Path Types
ImplementationSpecific
- Regex pattern matching
- Capture groups for rewriting
- Advanced routing rules
Alternative Path Types
Exact:/ws exactly (no trailing slash or subpaths).
Prefix:
/backend, /backend/, /backend/* (standard prefix matching).
Ingress Controller
NGINX Ingress Controller
The platform uses the NGINX Ingress Controller:- High-performance L7 load balancing
- WebSocket support
- URL rewriting and redirects
- Rate limiting and authentication
- Custom error pages
Installation
Request Flow
Complete Request Path
WebSocket Request Flow
Advanced Annotations
Common NGINX Annotations
cert-manager Annotations
Multiple Host Example
Extend Ingress for multiple domains:Operations
Apply Ingress
Check Ingress Status
View Ingress Logs
Test Ingress Routing
Troubleshooting
Certificate Issues
Routing Issues
Path Rewrite Issues
Best Practices
- Use TLS: Always enable HTTPS for production traffic
- cert-manager: Automate certificate management with cert-manager
- Path Design: Use clear, RESTful path structures
- Rewrite Rules: Test rewrite rules thoroughly before production
- WebSocket Support: Configure appropriate timeouts for long-lived connections
- Rate Limiting: Protect backend services with rate limits
- Monitoring: Monitor Ingress controller metrics and logs
- Multiple Environments: Use different hosts/paths for staging and production
Security Considerations
- TLS Version: Ensure TLS 1.2+ is enforced
- Certificate Validation: Use production Let’s Encrypt issuer
- CORS: Configure CORS policies for API endpoints
- Rate Limiting: Prevent abuse with rate limits
- Authentication: Add authentication annotations for sensitive paths
- IP Whitelisting: Restrict access by source IP if needed
Related Resources
- Services - Backend services that Ingress routes to
- Deployments - Application pods behind services
- NGINX Ingress Controller Docs
- cert-manager Documentation

