无法在Argo CD中添加其他种类群集



我的本地机器中有两种集群。一个被命名为dev-cluster,另一个被称为kind。Argo CD已部署并在dev-cluster上运行。当我尝试使用argocd cluster add kind-kind --name stage命令将第二个集群添加到Argo CD时,我收到以下错误


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

`kubectl config-get-contexts的输出是

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

我尝试使用kubectl port-forward kube-apiserver-kind-control-plane -n kube-system --context kind-kind 45249:45249将端口转发到端口45249,并尝试在Argo Cd 中添加集群

此外,我已经尝试使用其节点ip将第二个集群添加到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 

对于这两种情况,它都显示出相同的错误

我找到了一个解决方法。

第二个集群的默认命名空间中的服务kubernetes是一种ClusterIP类型。我已将其更改为NodePort服务。我的kubeconfig将ip和端口用作第二个集群的127.0.0.1:45249。我将其更改为我的第二个集群的kubernetes服务的节点ip地址和NodePort-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

相关内容

  • 没有找到相关文章

最新更新