I have deployed an AWS EKS cluster and then an nginx-ingress-controller.
I then tried to deploy ArgoCD on the cluster. The ingress seems to be working fine, the requests to my loadbalancer DNS hostname returns 200 when I try myloadbalancerDNS.com/argo
BUT none of the static assets are being loaded, something is wrong with my route/pathing rules.
Here is my ingress
alb.ingress.kubernetes.io/ssl-passthrough: "true"
kubernetes.io/ingress.class: nginx
meta.helm.sh/release-name: argocd
meta.helm.sh/release-namespace: argo
nginx.ingress.kubernetes.io/backend-protocol: HTTP
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/use-regex: "true"
creationTimestamp: "2024-02-27T17:22:38Z"
generation: 7
labels:
app.kubernetes.io/component: server
app.kubernetes.io/instance: argocd
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: argocd-server
app.kubernetes.io/part-of: argocd
app.kubernetes.io/version: v2.10.1
helm.sh/chart: argo-cd-6.2.3
name: argocd-server
namespace: argo
resourceVersion: "302643"
uid: 09919fd3-d032-4dba-9fa7-0e693e797357
spec:
ingressClassName: nginx
rules:
- host: a3d5ec6525a3642b1a50bc17d3e46b34-221545762.eu-west-1.elb.amazonaws.com
http:
paths:
- backend:
service:
name: argocd-server
port:
number: 443
path: /argo/?(.*)
pathType: Exact
Note when I run curl a3d5ec6525a3642b1a50bc17d3e46b34-221545762.eu-west-1.elb.amazonaws.com/argo/assets/fonts.css
it works, but when I visit the page on the browser a3d5ec6525a3642b1a50bc17d3e46b34-221545762.eu-west-1.elb.amazonaws.com/argo, it returns 404 errors for all static assets
So TL;DR
When i visit myLoadBalancer.com/argo, I’m expecting my nginx-ingress-controller to load assets from myLoadBalancer.com/argo/assets/etc, but instead it’s look for myLoadBalancer.com/assets directly
2
Answers
Your issue seems to be related to how the path is being rewritten by the Nginx Ingress Controller for your ArgoCD instance.
Your current
pathType
isExact
, which means it will only match the exact path/argo/?(.*)
https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types. This is likely not what you want since you need to handle paths under/argo
such as/argo/assets/fonts.css
. Consider changing thepathType
toPrefix
or adjusting the path regex to correctly handle subpaths:You can use
curl
to test various paths to ensure that the ingress is routing traffic as expected and check the Nginx Ingress Controller’s logs to see how requests are being processed and where they are being forwarded.The
path: /argo/?(.*)
in your ingress rules is not matching the path of your static assets, which is/argo/assets/
.You should modify your ingress rules to match the correct path for your static assets. Update the path in your ingress rules to
/argo/assets/?(.*)
.The nginx-ingress-controller should correctly route requests to your static assets, and you should no longer encounter 404 errors.