argo-workflows: BASE_HREF is not working
Cant Access argo UI if I change the BASE_HREF to something other than /
I want it to be accessible at xxx.com/argo
To reproduce it you can just change the env variable BASE_HREF to something other than /. I have tried these - argo, /argo , /argo/ . None of these work.
Getting this on the console of my browser -
Uncaught SyntaxError: Unexpected token '<'
THis is the image we are using: argoproj/argocli:v2.7.4
- Kubernetes version : 1.16
Message from the maintainers:
If you are impacted by this bug please add a đź‘Ť reaction to this issue! We often sort issues this way to know what to prioritize.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 47
- Comments: 31 (7 by maintainers)
Commits related to this issue
- docs: Document ingress set-up. Closes #3080 (#3592) — committed to argoproj/argo-workflows by alexec 4 years ago
For those who are experiencing this issue with Treafik Ingress Controller, you will need to create a “StripPrefix” middleware that matches the BASE_HREF value. Make sure to attach that to your ingress (if you are using ingress instead of IngressRoute):
In my case, I am using “/workflows/” as the BASE_HREF value:
and my Ingress includes the following annotation:
traefik.ingress.kubernetes.io/router.middlewares: argo-workflows-workflow-prefix@kubernetescrd
Hopefully, this will help someone!
@alexec I got it working with this setup
BASE_HREF
set to subpath with trailing slash (trailing slash is an important one because of how<base href>
tag works, I guess we can just update docs here https://github.com/argoproj/argo/blob/676868f31da1bce361e89bebfa1eea81471784ac/docs/argo-server.md#base-href from/argo
to/argo/
- that’s what got me confused at first), or maybe just add a check to always append a slash if it’s not present.Service
, just put it behindIngress
with a similar config:Does anybody has a similar one for AWS LoadBalancer Controller, instead of nginx controller?
After a day of trying various permutations, here is a config that works for me. I am using
k3s
, versionv1.24.4+k3s1
, with the default traefik deployment.Reproducible example -
Argo patch file:
Traefik ingress:
Wait for pods to get into a running state
Visit http://[IP_ADDRESS]/argo/
Hope this helps someone with a similar issue.
an updated version that works with k8s 1.27 (at least where I tested):
Rough Istio equivalent of the traefik manifests above in case someone needs it. Istio’s rewrite here is doing the job of traefik’s stripPrefix.
For anyone who finds their way to this thread - or runs into this problem - here’s a working implementation for a local K3D cluster. It’s all laid out flexibly enough that it should be portable/obvious to understand + obvious to modify or adapt to your own workflow/implementation.
Overview
K3D is a wrapper and set of conveniences for running a fully-dockerized local cluster on Rancher K3s.
- LoadBalancer: Klipper (built-in default LB for K3D/K3s) - Ingress: Traefik - ArgoCD Install Method: Bitnami Helm Chart (I like it, I know it’s not perfect…or from “the source,” but it suits our workflows and needs, so that’s what I chose).
Notes
In this configuration, there are a few things to be aware of.
web
service, notweb-secure
(because HTTP)configurationManagementPlugin
sidecar which you can use for building your charts & doing “last-mile kustomization” in case you don’t want ArgoCD just treating/building your apps as vanilla Kustomize appsAND ONE MORE THING
YOU CAN have ArgoCD just treat the included Kustomize example as an Argo App of type Kustomize. In order to do so - and not NEED a configurationManagementPlugin sidecar - please see this configMapGenerator…these are required configMap entries for ArgoCD to be able to properly/correctly build Kustomizations that include Helm charts in just one step (through
kustomize build --enable-helm .
)See here for documentation:
See here for the configMap: https://github.com/armenr/5thK8s/blob/main/dependencies/argo-cd/generators/configmap-argocd-cm.yaml
The goodies
Example Repo: https://github.com/armenr/5thK8s
K3D config: https://github.com/armenr/5thK8s/blob/main/assets/k3d_local.yaml
Traefik Ingress Example: https://github.com/armenr/5thK8s/blob/main/dependencies/argo-cd/patches/traefik-middleware.yaml —> BIG THANK YOU TO @erkerb4
Helm Values for ArgoCD: https://github.com/armenr/5thK8s/blob/main/dependencies/argo-cd/values.yaml
How to Build/Deploy
@alexec Looking for AWS Loadbalancer Controller. Any one has an example?
@alexec In ideal case it should load the UI on /argo we shouldn’t put extra routes.
you config saved the day. Thanks a lot. I just had to turn off ssl redirect.