argoproj / argo-cd

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

Terminal exec on some containers throws error "websocket: unexpected reserved bits 0x60" #9425

Closed n888 closed 2 years ago

n888 commented 2 years ago

Checklist:

Describe the bug

I am using the 'latest' image tag v2.4.0+c29651d from 2022-05-16 to test this feature.

Some pods only display the shell prompt, and I am not able to input anything via keyboard.

ArgoCD logs an error when trying to launch a terminal in for the problematic containers: websocket: unexpected reserved bits 0x60

The one thing common thing about the containers with issues is they are using alpine based images. I have confirmed the issue with the following images so far:

I have tested on EKS and k3s and both display the same behaviour.

Logs:

To Reproduce

Deploy a Pod with an alpine based image and open terminal in ArgoCD UI.

Expected behavior

Should be able to enter keystrokes into the terminal.

Screenshots

Version

argocd: v2.4.0+c29651d
  BuildDate: 2022-05-16T15:41:21Z
  GitCommit: c29651de917ff5ecdf91648ea9281b9bb0352e21
  GitTreeState: clean
  GoVersion: go1.18.2
  Compiler: gc
  Platform: linux/arm64

Logs

server time="2022-05-16T22:13:38Z" level=info msg="received unary call /cluster.SettingsService/Get" grpc.method=Get grpc.request.claims="{\"at_hash\":\"Ulm5SphVcflrtzyB31C9lA\",\"aud\":\"qm5l3mk26hd16
m56hqi4o0k14\",\"auth_time\":1652739025,\"cognito:groups\":[\"admin\"],\"cognito:username\":\"user\",\"email\":\"user@user.com\",\"email_verified\":true,\"event_id\":\"7787e204-1918-4afb-8398-94e45
dc7c1b5\",\"exp\":1652742625,\"iat\":1652739025,\"iss\":\"https://IDP.com/us-west-2_xxx\",\"phone_number\":\"+1\",\"phone_number_verified\":true,\"sub\":\"b5
7c61e5-ef73-4cfe-b683-0077465c1f24\",\"token_use\":\"id\"}" grpc.request.content= grpc.service=cluster.SettingsService grpc.start_time="2022-05-16T22:13:38Z" span.kind=server system=grpc               
server time="2022-05-16T22:13:38Z" level=info msg="Ignore status for CustomResourceDefinitions"                                                                                                          
server time="2022-05-16T22:13:38Z" level=info msg="Ignore '/spec/preserveUnknownFields' for CustomResourceDefinitions"                                                                                   
server time="2022-05-16T22:13:38Z" level=info msg="finished unary call with code OK" grpc.code=OK grpc.method=Get grpc.service=cluster.SettingsService grpc.start_time="2022-05-16T22:13:38Z" grpc.time_m
s=10.738 span.kind=server system=grpc                                                                                                                                                                    
server E0516 22:13:38.699432       1 v2.go:105] EOF                                                                                                                                                      
server time="2022-05-16T22:13:39Z" level=error msg="read message err: websocket: unexpected reserved bits 0x60"                                                                                          
server E0516 22:13:39.828053       1 v2.go:105] websocket: unexpected reserved bits 0x60                                                                                                                 
server time="2022-05-16T22:14:25Z" level=info msg="finished streaming call with code OK" grpc.code=OK grpc.method=WatchResourceTree grpc.service=application.ApplicationService grpc.start_time="2022-05-
16T22:13:25Z" grpc.time_ms=60000.566 span.kind=server system=grpc         

Please let me know if I can provide or test anything further, Thank you.

n888 commented 2 years ago

Looks like ArgoCD is having issues spawning a terminal with the alpine ash shell.

It works after adding bash package:

apk add bash

djfinnoy commented 2 years ago

Encountered this problem, and discovered something important:

When you get the RBAC settings correct, you are only able to use UI exec on containers where bash is installed. Containers with sh will give you weird issues with websockets, and terminals where you are not allowed to type any input.

crenshaw-dev commented 2 years ago

I'm gonna close this as a duplicate to consolidate discussion on https://github.com/argoproj/argo-cd/issues/9641. If these turn out to be distinct, I'll reopen. :-)