SE
sebastianczech/k8s-ingress-auth
Configuration of ingress Nginx controller with multiple authentication options
Ingress Nginx controller with authentication
Ingress
Links
Prerequisites
- Create Kubernetes cluster using
kind:
task cluster-create
- Configure ingress
task cluster-ingress-setup
- Define DNS names on local machine e.g.:
vi /etc/hosts
and add 3 FQDNs for localhost:
127.0.0.1 localhost podtato.example.com podinfo.example.com foobar.example.com
Bearer Token
- Setup Kubernetes dashboard:
task dashboard-ingress-setup
- Access dashboard https://localhost:8443
OAuth proxy
GitHub
- Configure GitHub OAuth application in https://github.com/settings/applications/new:

- Provision OAuth proxy:
task oauth-proxy-setup
- Create
podinfoapp:
task app-podinfo-setup
- Check app https://podinfo.example.com/
Microsoft Entra ID
- Configure app registration
az login
terraform init
terraform apply -auto-approve
terraform output -raw client_id > client_id.txt
terraform output -raw client_secret > client_secret.txt
terraform output -raw sp_id > sp_id.txt
terraform output -raw tenant_id > tenant_id.txt
terraform output -raw group_id > group_id.txt
terraform output -raw oidc_issuer_url > oidc_issuer_url.txt
- Check app registration
az account subscription list
az ad app list
- Provision OAuth proxy:
task oauth-proxy-setup
- Create
podinfoapp:
task app-podinfo-setup
- Check app https://podinfo.example.com/
Basic authentication
- Provision Basic authentication
- Create
podtato:
task app-podtato-setup
- Access app https://podtato.example.com/
Client certificate authentication
- Provision Client certificate authentication
- Create
foo-barapp:
task app-foo-bar-setup
task app-foo-bar-check
More information:
- SSL/TLS in Learning CI/CD
- Add SSL / TLS Certificate or .PEM file to Kubernetes’ Pod’s trusted root ca store
Gateway API
Links
- Gateway API
- Implementations:
Prerequisites
- Create Kubernetes cluster using
kind:
kind create cluster --config code/single-node-extra-port-mapping-gateway-api.yaml --name home-lab
- Deploy
blixt
kubectl apply -k https://github.com/kubernetes-sigs/gateway-api/config/crd/experimental?ref=v1.2.1
cd ..
git clone https://github.com/kubernetes-sigs/blixt
make build.all.images TAG=latest
make load.all.images TAG=latest
kubectl apply -k config/default
- Deploy ``:
kubectl kustomize "https://github.com/nginx/nginx-gateway-fabric/config/crd/gateway-api/standard?ref=v1.6.2" | kubectl apply -f -
helm install ngf oci://ghcr.io/nginx/charts/nginx-gateway-fabric --create-namespace -n nginx-gateway --set service.create=false
kubectl apply -f code/gateway-api-node-port.yaml
- Create
cafeapplication:
kubectl apply -f code/app-cafe.yaml
- Define DNS names on local machine e.g.:
vi /etc/hosts
and add 1 FQDNs for localhost:
127.0.0.1 localhost cafe.example.com
- Check application:
kubectl describe httproutes
kubectl describe gateways
curl --resolve cafe.example.com:8080:127.0.0.1 http://cafe.example.com:8080/coffee
curl --resolve cafe.example.com:8080:127.0.0.1 http://cafe.example.com:8080/tea
On this page
Languages
Shell49.1%HCL45.8%Python5.2%
Contributors
Apache License 2.0
Created February 14, 2025
Updated May 16, 2025