1

I am having two kind clusters in my local machine . One is named as dev-cluster and another one as kind.The Argo CD is deployed and running on dev-cluster.When i try to Add the second cluster to Argo CD using argocd cluster add kind-kind --name stage command i am getting the following error


WARNING: This will create a service account `argocd-manager` on the cluster referenced by context `kind-kind` with full cluster level privileges. Do you want to continue [y/N]? y
INFO[0005] ServiceAccount "argocd-manager" already exists in namespace "kube-system" 
INFO[0005] ClusterRole "argocd-manager-role" updated    
INFO[0005] ClusterRoleBinding "argocd-manager-role-binding" updated 
FATA[0005] rpc error: code = Unknown desc = Get "https://127.0.0.1:45249/version?timeout=32s": dial tcp 127.0.0.1:45249: connect: connection refused

The output of `kubectl config get-contexts is

CURRENT   NAME               CLUSTER            AUTHINFO           NAMESPACE
*         kind-dev-cluster   kind-dev-cluster   kind-dev-cluster   
          kind-kind          kind-kind          kind-kind          

I have tried to do a port forward to the port 45249 using kubectl port-forward kube-apiserver-kind-control-plane -n kube-system --context kind-kind 45249:45249 and tried to add the cluster in Argo Cd

Also i have tried to add the second cluster using its node ip to Argo CD

kubectl get nodes -o wide --context kind-kind

NAME                 STATUS   ROLES           AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION      CONTAINER-RUNTIME
kind-control-plane   Ready    control-plane   42d   v1.25.0   172.18.0.3    <none>        Ubuntu 22.04.1 LTS   5.15.0-52-generic   containerd://1.6.7
argocd cluster add kind-kind --name stage --server 172.18.0.3:45249

WARNING: This will create a service account `argocd-manager` on the cluster referenced by context `kind-kind` with full cluster level privileges. Do you want to continue [y/N]? y
INFO[0001] ServiceAccount "argocd-manager" already exists in namespace "kube-system" 
INFO[0001] ClusterRole "argocd-manager-role" updated    
INFO[0001] ClusterRoleBinding "argocd-manager-role-binding" updated 
FATA[0001] Failed to establish connection to 172.18.0.3:45249: dial tcp 172.18.0.3:45249: connect: connection refused 

For both cases it is showing the same error

Pratheesh
  • 565
  • 4
  • 19

1 Answers1

0

I found a workaround for this.

The service kubernetes in default namespace of second cluster was a type of ClusterIP. i have changed it to NodePort service. My kubeconfig was using the ip and port as 127.0.0.1:45249 for the second cluster. I changed it to node ip address and NodePort of the kubernetes service of my second cluster - 172.18.0.3:31413

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://127.0.0.1:44135
  name: kind-dev-cluster
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://172.18.0.3:31413
  name: kind-kind
Pratheesh
  • 565
  • 4
  • 19