argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.71k stars 5.4k forks source link

Error while adding cluster via argocd login --core #13033

Open sabinayakc opened 1 year ago

sabinayakc commented 1 year ago

Checklist:

Describe the bug

When adding a cluster using argocd cli and cluster context, I get the following error.

Command: kubectl config set-context --current --namespace=argocd argocd login --core argocd cluster add ${CLUSTER_TO_ADD} --name ${CLUSTER_NAME} -y

Output:

  time="2023-03-28T18:23:18Z" level=info msg="ServiceAccount \"argocd-manager\" created in namespace \"kube-system\""
  time="2023-03-28T18:23:18Z" level=info msg="ClusterRole \"argocd-manager-role\" created"
  time="2023-03-28T18:23:18Z" level=info msg="ClusterRoleBinding \"argocd-manager-role-binding\" created"
  time="2023-03-28T18:23:23Z" level=info msg="Created bearer token secret for ServiceAccount \"argocd-manager\""
  time="2023-03-28T18:23:25Z" level=error msg="finished unary call with code Unknown" error="cannot find pod with selector: [app.kubernetes.io/name=argocd-redis-ha-haproxy app.kubernetes.io/name=argocd-redis]" grpc.code=Unknown grpc.method=Create grpc.service=cluster.ClusterService grpc.start_time="2023-03-28T18:23:25Z" grpc.time_ms=366.762 span.kind=server system=grpc
  time="2023-03-28T18:23:25Z" level=fatal msg="rpc error: code = Unknown desc = cannot find pod with selector: [app.kubernetes.io/name=argocd-redis-ha-haproxy app.kubernetes.io/name=argocd-redis]"

To Reproduce

Expected behavior

Version Helm: v5.27.0 ArgoCD: v2.6.5 EKS: 1.25

todaywasawesome commented 1 year ago

@sabinayakc Would you try the command again but add --grpc-web? I wouldn't think that it would fix it but for some reason it can't find the pods it's looking for.

dtwilliamsWork commented 1 year ago

I’m also getting this problem. It won’t create the argocd-manager service account on kube-system as it says unauthorised. I’m using EKS v1.25

Do I need to reconfigure any of the service accounts that Argo is using?

I’ve run “kubectl auth can-i create serviceaccount -n kube-system” which returns yes so assume it’s which account Argo is using that doesn’t have permissions??

mtougeron commented 1 year ago

This is probably related to https://github.com/argoproj/argo-cd/issues/12721

s3than commented 9 months ago

This issue is that the argocd cli hardcodes app.kubernetes.io/name and the helm chart uses app and has no way to add additional items in the subchart used for installing redis-ha

s3than commented 9 months ago

See https://github.com/argoproj/argo-cd/blob/master/common/common.go#L151

vainkop commented 8 months ago
argo-cd/charts/redis-ha/values.yaml
## Custom labels for the redis pod
labels:
  app.kubernetes.io/name: argocd-redis
  ## Custom labels for the haproxy pod
  labels:
    app.kubernetes.io/name: argocd-redis-ha-haproxy
s3than commented 8 months ago

Adding the label to the chart works.. though it would be nice to be able to pass the whole key/value instead