我的本地机器上有两种集群。一个被命名为dev集群,另一个命名为kind.The Argo,它部署并运行在dev集群上。当我尝试使用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上下文”的输出是
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中添加集群。
此外,我还尝试使用其节点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.7argocd 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 对于这两种情况,都显示了相同的错误。
发布于 2022-11-01 12:11:36
我找到了解决办法。
第二个集群的默认命名空间中的服务kubernetes是一种ClusterIP类型。我已将其更改为NodePort服务。我的kubeconfig使用ip和端口作为第二个集群的127.0.0.1:45249。我将其更改为第二个集群172.18.0.3:31413的kubernetes服务的节点ip地址和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-kindhttps://stackoverflow.com/questions/74274016
复制相似问题