Advertisement
yiorgos

reverse-proxy-2

Dec 18th, 2024 (edited)
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.63 KB | None | 0 0
  1. # Assuming Docker Desktop Kubernetes, this is a reverse proxy
  2. # leveraging the ingress-nginx to reverse proxy with api.chucknorris.io:
  3. # curl -k -v -H "Host: chucknorris.local" https://kubernetes.docker.internal/jokes/random
  4. ---
  5. apiVersion: cert-manager.io/v1
  6. kind: ClusterIssuer
  7. metadata:
  8.   name: chucknorris
  9. spec:
  10.   selfSigned: {}
  11. ---
  12. apiVersion: v1
  13. kind: Service
  14. metadata:
  15.   name: chucknorris
  16. spec:
  17.   type: ExternalName
  18.   externalName: api.chucknorris.io
  19. ---
  20. apiVersion: discovery.k8s.io/v1
  21. kind: EndpointSlice
  22. metadata:
  23.   name: chucknorris-1
  24.   labels:
  25.     kubernetes.io/service-name: chucknorris
  26. addressType: FQDN
  27. ports:
  28. - protocol: TCP
  29.   port: 443
  30. endpoints:
  31. - addresses:
  32.  - "api.chucknorris.io"
  33. ---
  34. apiVersion: networking.k8s.io/v1
  35. kind: Ingress
  36. metadata:
  37.   annotations:
  38.     cert-manager.io/cluster-issuer: "chucknorris"
  39.     nginx.ingress.kubernetes.io/proxy-ssl-verify: "true"
  40.     nginx.ingress.kubernetes.io/proxy-ssl-verify-depth: "2"
  41.     nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
  42.     nginx.ingress.kubernetes.io/proxy-ssl-server-name: "on"
  43.     nginx.ingress.kubernetes.io/proxy-ssl-name: api.chucknorris.io
  44.     nginx.ingress.kubernetes.io/upstream-vhost: api.chucknorris.io
  45.     nginx.ingress.kubernetes.io/proxy-ssl-secret: default/chucknorris-local
  46.   name: chucknorris
  47. spec:
  48.   ingressClassName: nginx
  49.   tls:
  50.   - hosts:
  51.    - chucknorris.local
  52.     secretName: chucknorris-local
  53.   rules:
  54.   - host: chucknorris.local
  55.     http:
  56.       paths:
  57.       - path: /
  58.         pathType: Prefix
  59.         backend:
  60.           service:
  61.             name: chucknorris
  62.             port:
  63.               number: 443
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement