I've been struggling to solve a problem for days. I have a bare metal cloud instance with MetalLB and Nginx-Ingress deployed.
- Kubernetes: 1.29.2
- MetalLB: 0.14.3
- Nginx-Ingress: 3.4.3
- Nginx in Docker image: 1.15-alpine
- CRI: containerd://1.6.28
- CNI: Calico 3.27.2
Behind the Ingress I have a Jenkins instance and everything works fine. Now I'm trying to deploy an Angular app and I have used the same Ingress configuration in order to deploy it. The angular app sits behind an Nginx and I keep getting 504 Gateway Time Out and I just cannot understand why.
Nginx-Ingress is in the "default" namespace, Jenkins in a "devops-tools" namespace and Angular service in "development" namespace.
Note I've also tried a configuration using HTTPS on 443 but it yielded the same results.
Note curl on the Service endpoint returns the index.html
adminFrontend.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: admin-fe
namespace: development
spec:
replicas: 1
selector:
matchLabels:
app: admin-fe-server
template:
metadata:
labels:
app: admin-fe-server
spec:
imagePullSecrets:
- name: pull-secret-gcr
containers:
- name: admin-fe
imagePullPolicy: Always
image: myimage
resources:
ports:
- containerPort: 80
volumeMounts:
- name: certs-volume
mountPath: /opt/certs/
volumes:
- name: certs-volume
hostPath:
path: /opt/data/certs
type: Directory
---
apiVersion: v1
kind: Service
metadata:
name: admin-fe-service
namespace: development
spec:
type: ClusterIP
selector:
app: admin-fe-server
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: admin-fe
namespace: development
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: 10m
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
ingressClassName: nginx
tls:
- hosts:
- subdomain.domain.com
secretName: domain-tls-development
rules:
- host: subdomain.domain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: admin-fe-service
port:
number: 80
Nginx on the docker image default.conf
upstream adminBackend {
server admin-be:8080;
}
server {
listen 80;
listen [::]:80;
server_name subdomain.domain.com;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
location /app {
proxy_pass http://adminBackend;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_http_version 1.1;
}
}
Log from nginx-ingress-controller pod
kubectl describe ingress admin-fe -n development

