Specifications

SpecificationValue
Chart
https://charts.bitnami.com/bitnami/nginx
Chart Version13.2.13
Nginx Version
1.23.2


Pulling the Chart

helm repo add bitnami https://charts.bitnami.com/bitnami
helm pull bitnami/nginx


Exposing on an Ingress

The following settings will enable an ingress. The annotation will perform the re-writing to the end URL removing /app.

ingress:
  enabled: true
  hostname: "localhost"
  annotations:
     nginx.ingress.kubernetes.io/rewrite-target: /$2
  path: /app(/|$)(.*)
  pathType: Prefix
  ingressClassName: "nginx"


Exposing as a Nodeport

We can update the values.yaml to enable a Nodeport by updating the following parameters:

service:
  type: NodePort
  nodePorts:
    http: "30080"
    https: "30443"


Setting up the Reverse Proxy

In the following example, we are proxying requests for Kubernetes and Jira. 

serverBlock: |-
  server {
    listen 0.0.0.0:8080;
    resolver kube-dns.kube-system.svc.cluster.local;
  
    location /jira/ {
      set $backend http://jira-service:8080;
      proxy_pass         $backend;
      rewrite /jira/(.*) /$1  break; 
      proxy_redirect     off;
      proxy_set_header   Host $host;
    }
  
    location /kubernetes/ {
      set $backend https://kubernetes.default.svc.cluster.local;
      proxy_pass         $backend;
      rewrite /kubernetes/(.*) /$1  break; 
      proxy_redirect     off;
      proxy_set_header   Host $host;
    }
  }


NOTE: In order to prevent startup errors, we used a variable for proxypass and defined a resolver for name lookups.


Postman Collections

  • No labels