Nginx Ingress Controller

Coffee & Tea Demo

Prerequisites

In this demo we’ll deploy a sample coffee & tea application with kubernetes ingress controller in qbo.

Dependency Validated or Included Version(s) Notes
kubernetes ingress controller v1.9.5 Supported Versions table
kubernetes v1.27.3

https://github.com/kubernetes/ingress-nginx?tab=readme-ov-file#supported-versions-table

QBOT

Install

Run

./qbot nginx

Deploy

Kubernetes Cluster

Ingress Controller

/usr/bin/kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.9.5/deploy/static/provider/cloud/deploy.yaml

Coffee & Tea App

/usr/bin/kubectl apply -f /home/alex/qbo-demo/coffee/ingress-nginx/cafe

Configure

Patch Service

Set externalTrafficPolicy to Cluster

kubectl patch svc  ingress-nginx-controller -p '{"spec":{"externalTrafficPolicy":"Cluster"}}' -n ingress-nginx
kubectl patch svc ingress-nginx-controller --type='json' -p '[{"op":"replace","path":"/spec/type","value":"NodePort"}]' -n ingress-nginx

Access

Get Endpoint

Linux

NODEPORT=$(kubectl get svc -n ingress-nginx -o json | jq -r '.items[].spec.ports[]? | select( .port == 443) | select(.nodePort) | .nodePort')
NODELST=$(kubectl get nodes -o json | jq '.items[].status.addresses[] | select(.type=="InternalIP") | .address' | tr -d '\"' | tr '\n' ' ')

Windows

(WSL2)

kubectl patch svc ingress-nginx-controller --type='json' -p '[{"op":"replace","path":"/spec/type","value":"ClusterIP"}]' -n ingress-nginx
kubectl port-forward svc/ingress-nginx-controller -n ingress-nginx 9443:443

Test

If the response code 200 the deployment was successful.

Linux

for i in $NODELST; do
curl -kv -H 'host: cafe.example.com' https://$i:$NODEPORT/coffee
done

Windows

(WSL2)

curl -k -m 3 --write-out '%{http_code}' --silent --output /dev/null -H 'host: cafe.example.com'  https://localhost:9443/tea