9

I just tried to go over the getting started guide of Argocd found here https://argo-cd.readthedocs.io/en/stable/getting_started/.
I did steps 1 and 2 and then ran the command argocd login --core to skip steps 3-5 (as it said in the guide).
when running the next command
argocd app create guestbook --repo https://github.com/argoproj/argocd-example-apps.git --path guestbook --dest-server https://kubernetes.default.svc --dest-namespace default.
to apply the app itself I got the following error: FATA[0000] configmap "argocd-cm" not found. Although I did find it on the cluster with the label app.kubernetes.io/part-of: argocd.
I also tried going back to steps 3-5 and changing the server and namespace but some steps didn't work or I didn't know what to do in them, I also got the same error during the second command of step 5. Thanks for the help.

gshabi
  • 91
  • 1
  • 2
  • Looks like the kubectl apply in step one creates that configmap. Do you see any resources in the argocd namespace? – jordanm Oct 07 '21 at 15:28
  • Yes, the ConfigMap itself exists but for some reason it doesn't register it, In one of the steps you add the clusters context to the Argocd but it didn't help. I also tried creating the application in the UI but Im still getting an error. – gshabi Oct 08 '21 at 13:56
  • Note, if you edit a config map via Portainer (v2.16.2) web interface, it may remove the `app.kubernetes.io/part-of` label. – marekful Mar 03 '23 at 16:59

2 Answers2

28

Although the configmap is in the argocd namespace, if argocd is not your current namespace, it won't work. To make sure it is, run :

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

That solved it for me. Command from How to switch namespace in kubernetes

Emile Tenezakis
  • 311
  • 3
  • 7
5

As noticed by @emile-tenezakis if it is a current namespace issue you can also use the argocd --namespace or -n flag to specify the targeted namespace.

I encountered the same error when running the export command:

argocd admin export
FATA[0000] configmaps "argocd-cm" not found 

And I was able to make it work like so:

argocd -n argocd admin export
Martin Tovmassian
  • 1,010
  • 1
  • 10
  • 19
  • 1
    You were able to make this work with the `-n` flag? Really? I'm running version 2.5.6 built last week. And it doesn't support this. I get `Error: unknown shorthand flag: 'n' in -n` and it doesn't show in the help menu. Plus I have noticed this issue which says it doesn't support it. https://github.com/argoproj/argo-cd/issues/9123. It is not too recent. But still. I would like to find out how you got this working on your argocd cli. It would be very helpful. – Byron Mansfield Jan 20 '23 at 15:58
  • 2
    @ByronMansfield my answer is confusing indeed. The `--namespace` option is not a generic one and its usage depends on the `argocd` sub-command you need to run. For example you can add the `--namespace` option when running sub-commands like `argocd admin export`, `argocd cluster`, `argocd proj`, `argocd repo` – Martin Tovmassian Jan 21 '23 at 07:36
  • Ah, I see. Thank @martin-tovmassian. That clears it up :) – Byron Mansfield Jan 21 '23 at 17:05