I am working on the lab exercise Lab - Explore Multi-Cluster, Declarative, and Helm-Chart Deployment in the GitOps with ArgoCD course, and I am currently at the question where we have to add the secondary cluster to argocd.
However, the argocd cluster add cluster2-controlplane command fails with error
FATA[0002] rpc error: code = Unknown desc = error getting server version: Get “https://cluster2-controlplane:6443/version?timeout=32s”: dial tcp: lookup cluster2-controlplane on 172.20.0.10:53: no such host
Seeing the DNS address it seems coredns is what fails to resolve the hostname to IP. I have gotten past it by adding a host plugin entry to the corefile, but I wanted to check if that was an intended step that we needed to carry out as part of the quesiton, or was coredns not configured correctly for the question before hand?
In case I am missing something please let me know. Thank you for your help.
The problem here is that the command you ran has the wrong parameter. You ran
- “argocd cluster add cluster2-controlplane”
This was incorrect, since “argcd cluster add” takes the context as the parameter. If you look at “k config get-contexts”, you’ll see:
controlplane ~ ➜ k config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
cluster2 cluster2 cluster2
* kubernetes-admin@kubernetes kubernetes kubernetes-admin
If you enter it that way, the command works, and argocd can find the new cluster.
Oh I see, my bad. It seems during the post creation I mistyped. Actually I did indeed run argocd cluster add cluster2 after checking the config and I also checked the solution too in case I was making a mistake, and I can confirm that because it gave me the y/N prompt to create the resources on the cluster after I ran the command and only then it failed.
If we run argocd cluster add cluster2-controlplane it actually fails with FATA[0000] Context cluster2-controlplane does not exist in kubeconfig, not the no such host error I mentioned.
However, I restarted the lab to check now and see that it runs now, which possibly means that during the lab initialization that time something did not run correctly. Could that be possible?
Based on what I saw when I ran the lab? Definitely. It’s worth looking at the argocd docs linked to the UI – it tells you that it wants a context. Not sure what it would do if it did not see a context with that name, as would be the case when you did that.
Got it. Thank you for your help on this.