Skip to content

Commit

Permalink
Add public-samples/trail-project-1-n75ia4/infrastructure/kubernetes/b…
Browse files Browse the repository at this point in the history
…ackend/ingress.yaml
  • Loading branch information
siddhantpp committed Dec 30, 2024
1 parent 1e8fcdd commit 5064431
Showing 1 changed file with 74 additions and 0 deletions.
74 changes: 74 additions & 0 deletions infrastructure/kubernetes/backend/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Kubernetes Ingress API version 1.27+
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: backend-ingress
namespace: task-management
annotations:
# Ingress controller configuration
kubernetes.io/ingress.class: "nginx"

# SSL/TLS configuration
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
cert-manager.io/cluster-issuer: "letsencrypt-prod"

# Security headers and configurations
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_headers "X-Frame-Options: DENY";
more_set_headers "X-Content-Type-Options: nosniff";
more_set_headers "X-XSS-Protection: 1; mode=block";
more_set_headers "Referrer-Policy: strict-origin-when-cross-origin";
more_set_headers "Strict-Transport-Security: max-age=31536000; includeSubDomains; preload";
# CORS configuration
nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-methods: "GET, POST, PUT, DELETE, OPTIONS"
nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization"

# Rate limiting and DDoS protection
nginx.ingress.kubernetes.io/limit-rps: "10"
nginx.ingress.kubernetes.io/limit-connections: "20"
nginx.ingress.kubernetes.io/enable-modsecurity: "true"
nginx.ingress.kubernetes.io/enable-owasp-core-rules: "true"

# Proxy configurations and timeouts
nginx.ingress.kubernetes.io/proxy-body-size: "5m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "60"
nginx.ingress.kubernetes.io/proxy-send-timeout: "60"
nginx.ingress.kubernetes.io/proxy-connect-timeout: "60"

# Load balancing optimizations
nginx.ingress.kubernetes.io/load-balance: "round_robin"
nginx.ingress.kubernetes.io/upstream-hash-by: "$remote_addr"
nginx.ingress.kubernetes.io/affinity: "cookie"
nginx.ingress.kubernetes.io/session-cookie-name: "route"
nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"

# Monitoring and logging
nginx.ingress.kubernetes.io/enable-access-log: "true"
nginx.ingress.kubernetes.io/enable-rewrite-log: "true"
prometheus.io/scrape: "true"
prometheus.io/port: "10254"

spec:
# TLS configuration
tls:
- hosts:
- api.taskmanager.com
secretName: backend-tls

# Routing rules
rules:
- host: api.taskmanager.com
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: backend
port:
number: 80

0 comments on commit 5064431

Please sign in to comment.