argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.65k stars 5.38k forks source link

argocd admin dashboard configmap argocd-cm not found #14167

Open csantanapr opened 1 year ago

csantanapr commented 1 year ago

Checklist:

Describe the bug

can't start dashboard with cli

$ argocd admin dashboard                                                               
FATA[0000] configmap "argocd-cm" not found       

try passing namespace

$ argocd admin dashboard --namespace argocd                                                          
FATA[0000] configmap "argocd-cm" not found

It works if I switch the kubeconfig namespace context

$ kubectl config set-context --current --namespace argocd                                   
Context "arn:aws:eks:us-west-2:015299085168:cluster/ex-shell-script" modified.
$ argocd admin dashboard --namespace argocd                                  
Argo CD UI is available at http://localhost:8080

To Reproduce

Install latest version of argocd cli and argocd via helm chart

Version

argocd: v2.7.6+00c914a.dirty
  BuildDate: 2023-06-20T23:29:54Z
  GitCommit: 00c914a948d9e8ad99be8bd82a368fbdeba12f88
  GitTreeState: dirty
  GoVersion: go1.20.5
  Compiler: gc
  Platform: darwin/arm64
tibers commented 1 year ago

NINJA EDIT: Just updated to the latest and greatest argo v2.7.8 and I still have this problem.

Not to dog pile the issue but I am going to dogpile the issue...

I am getting the same errors from my automation when trying to add clusters to argo using the argocd cluster add command.

I have validated that the argo-cm configmap has the correct labels:

...
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd
...

Install code snippit:

...
kubectl config set-context --current --namespace=argocd 

./bin/argocd login $ARGOSERVER --core 

for resource_group in $(az aks list | grep resourceGroup | grep -v subscriptions | cut -f 4 -d \")
do
  cluster=${resource_group/-rg-/-aks-}
  az aks get-credentials -g $resource_group -n $cluster --admin --file ${KUBECONFIG}
  yes y | ./bin/argocd cluster add ${cluster}-admin
done
...

The logs look like:

time="2023-07-21T09:26:15-04:00" level=info msg="ServiceAccount \"argocd-manager\" already exists in namespace \"kube-system\""
time="2023-07-21T09:26:15-04:00" level=info msg="Role \"argocd/argocd-manager-role\" created"
time="2023-07-21T09:26:15-04:00" level=info msg="RoleBinding \"argocd/argocd-manager-role-binding\" created"
time="2023-07-21T09:26:16-04:00" level=fatal msg="configmap \"argocd-cm\" not found"

If I do something like yes y | ./bin/argocd --namespace argocd cluster add ${cluster}-admin I will get an error that the namespace doesn't exist on the target cluster.

SOLVED: The az login also changes the default context, and marks it as active. I had to use kubectl to point back at the argo server after doing the az login so it could find the configmap.

jgreat commented 1 year ago

Installed argocd core using the core-install.yaml manifest.

➜ argocd version
argocd: v2.8.0+804d4b8
  BuildDate: 2023-08-07T19:41:16Z
  GitCommit: 804d4b8ca6bc4c2cf02c5c971aa923ec5b8623f0
  GitTreeState: clean
  GoVersion: go1.20.6
  Compiler: gc
  Platform: linux/amd64

I'm also seeing this issue. Commands don't seem to be honoring the --namespace option. I can only get argocd commands to work if I switch the entire kubernetes config context to use the argocd namespace.

# Kubeconfig set with environment var
➜ export KUBECONFIG=/home/jgreat/.../cluster.yaml

# Set to default namespace
➜ argocd admin dashboard           
FATA[0000] configmap "argocd-cm" not found

# Try with --namespace
➜ argocd --namespace argocd admin dashboard
FATA[0000] configmap "argocd-cm" not found

# Switch context in config file
➜ kubens argocd
✔ Active namespace is "argocd"

# now it works?
➜ argocd admin dashboard
Argo CD UI is available at http://localhost:8080