argoproj / argo-cd

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

argocd login errors with "received the unexpected content-type "application/json"" #8009

Open brsolomon-deloitte opened 2 years ago

brsolomon-deloitte commented 2 years ago

Describe the bug

argocd login \
    --loglevel debug \
    --insecure \
    --username xx \
    --password 'xx' \
    xx.xx.xx.eks.amazonaws.com

FATA[0000] rpc error: code = Internal desc = transport: received the unexpected content-type "application/json"

Even when using --loglevel=debug, I don't have any visibility into what's going on here.

How can I get a more informative stacktrace here?

To Reproduce

Tough to do, wish I had more information to provide. K8s cluster has been running with zero issues for about 3 months. All resources are healthy.

k cluster-info and other diagnostics all show what looks like a normal cluster.

Expected behavior

Log in successfully via CLI.

Screenshots

If applicable, add screenshots to help explain your problem.

Version

argocd: v2.1.3+d855831
  BuildDate: 2021-09-29T21:51:21Z
  GitCommit: d855831540e51d8a90b1006d2eb9f49ab1b088af
  GitTreeState: clean
  GoVersion: go1.16.5
  Compiler: gc
  Platform: linux/amd64
adityasonittyl commented 2 years ago

@brsolomon-deloitte Can you try adding --grpc-web at the end of the previous command and test it?

brsolomon-deloitte commented 2 years ago

--grpc-web fails also, 403s with a different error message.

argocd login \
    --loglevel debug \
    --insecure \
    --username xx \
    --password 'xx' \
    xx.xx.xx.eks.amazonaws.com

FATA[0000] rpc error: code = Unknown desc = POST https://redacted.gr7.redactedeks.amazonaws.com:443/session.SessionService/Create failed with status code 403

I am able to successfully log in to ArgoCD UI using this username/password.

ArgoCD is exposed through Ingress, but I am calling login using the Kube control plane host from kubectl cluster-info.

rainfd commented 2 years ago

Do you login in argocd ui via xx.xx.xx.eks.amazonaws.com?

brsolomon-deloitte commented 2 years ago

Do you login in argocd ui via xx.xx.xx.eks.amazonaws.com?

No. Though I did log in via web UI which is an Ingress resource using ingress-nginx, if that matters. xx.xx.xx.eks.amazonaws.com is the K8s control plane API server itself which I do not believe provides a UI.

rainfd commented 2 years ago

No. Though I did log in via web UI which is an Ingress resource using ingress-nginx, if that matters. xx.xx.xx.eks.amazonaws.com is the K8s control plane API server itself which I do not believe provides a UI.

You can try argocd login your-web-ui.com to login

NabilusT commented 2 years ago

I've got the same issue trying to login using the argocd cli:

FATA[0015] rpc error: code = Unknown desc = unexpected HTTP status code received from server: 302 (Found); transport: received unexpected content-type "text/html; charset=UTF-8"

Did someone figured out how to fix this?

mikzuit commented 1 year ago

Steps to reproduce:

I am also on argocli argocd login --username <username> --password <password> myclusterdomain.azmk8s.io and gives :

`FATA[0031] rpc error: code = Internal desc = transport: received the unexpected content-type "application/json"`

update: if I agocd login --username <username> --password <password> <ip number> gives:

`FATA[0027] rpc error: code = FailedPrecondition desc = unsatisfied client version constraint: >= 1.4.0`

are this before and this bellow related?:

`FATA[0015] rpc error: code = Unknown desc = unexpected HTTP status code received from server: 302 (Found); transport: received unexpected content-type "text/html; charset=UTF-8` 

Any more info I could get? is this telling me my cluster RPC is somehow miss configured or not supported?

thanks

mikzuit commented 1 year ago

Steps to reproduce:

  • akscluster version: 1.25.4
  • argocd exposed as loadbalancer on external port (not ingress)
  • argocd version 2.3.3
  • I am able to login on website ui

I am also on argocli argocd login --username <username> --password <password> myclusterdomain.azmk8s.io and gives :

`FATA[0031] rpc error: code = Internal desc = transport: received the unexpected content-type "application/json"`

update: if I argocd login --username <username> --password <password> <ip number> gives:

`FATA[0027] rpc error: code = FailedPrecondition desc = unsatisfied client version constraint: >= 1.4.0`

are this before and this bellow related?:

`FATA[0015] rpc error: code = Unknown desc = unexpected HTTP status code received from server: 302 (Found); transport: received unexpected content-type "text/html; charset=UTF-8` 

Any more info I could get? is this telling me my cluster RPC is somehow miss configured or not supported?

thanks

Seems that I had installed some argocd-cli version 0.10 not able to connect , check here, https://github.com/argoproj/argo-cd/issues/983 .

I have installed this version:

 `argocd: v2.3.16+0ae7351
BuildDate: 2023-02-02T15:06:31Z
GitCommit: 0ae73513048a556282a20a7a371c1d896c756c8d
GitTreeState: clean
GoVersion: go1.17.13
Compiler: gc
Platform: linux/amd64`

which gives the same error but adding --grpc-web solves the problem.

`argocd login --username <your_username> --password <your_password> --insecure --grpc-web <ARGOCD_IP>`

keep in mind this works only on ip address, not fqdn.

please @brsolomon-deloitte check if this can close this issue.

jlucktay commented 1 year ago

When running argocd login <SERVER> make sure that, for the <SERVER> value, you are giving it the address of the Argo service (if you converted argocd-service to a LoadBalancer type, the EXTERNAL-IP column from kubectl get services --all-namespaces) and not the address of the Kubernetes control plane (from kubectl cluster-info). This tripped me up just now when going through the Getting Started documentation.

mikzuit commented 1 year ago

When running argocd login <SERVER> make sure that, for the <SERVER> value, you are giving it the address of the Argo service (if you converted argocd-service to a LoadBalancer type, the EXTERNAL-IP column from kubectl get services --all-namespaces) and not the address of the Kubernetes control plane (from kubectl cluster-info). This tripped me up just now when going through the Getting Started documentation.

Yeah, server url took me a while too. Thanks

tirelibirefe commented 11 months ago

ArgoCD CLI still cannot be used. I have AWS ALB before ingress too.

image

snji commented 11 months ago

ArgoCD CLI still cannot be used where i use argocd login. need help.

FATA[0000] rpc error: code = PermissionDenied desc = unexpected HTTP status code received from server: 403 (Forbidden); transport: received unexpected content-type "application/json"

mikzuit commented 11 months ago

ArgoCD CLI still cannot be used where i use argocd login. need help.

FATA[0000] rpc error: code = PermissionDenied desc = unexpected HTTP status code received from server: 403 (Forbidden); transport: received unexpected content-type "application/json"

I am guessing you are missing the '--plaintext' option in your command