virtctl console vm fails with "Can't connect to websocket (401): websocket: bad handshake""

744 views
Skip to first unread message

Kranthi Kumar

unread,
Jan 31, 2022, 3:01:37 AM1/31/22
to kubevirt-dev
Hi all,

In EKS Cluster I am able to connect to the console but in GKE Cluster its not working. I am able to get the vms, as well as all other resources with it. I have tried the virtctl application but getting "Can't connect to websocket (401): websocket: bad handshake". Below are some examples of about issue. Please suggest me If there is any workaround.$ kubectl cluster-info
Kubernetes control plane is running at https://34.141.40.169
calico-typha is running at https://34.141.40.169/api/v1/namespaces/kube-system/services/calico-typha:calico-typha/proxy
GLBCDefaultBackend is running at https://34.141.40.169/api/v1/namespaces/kube-system/services/default-http-backend:http/proxy
KubeDNS is running at https://34.141.40.169/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://34.141.40.169/api/v1/namespaces/kube-system/services/https:metrics-server:/proxyTo further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
virt-launcher-ubuntu-with-iperf-848jn 3/3 Running 0 16h
$ kubectl get vmi
NAME AGE PHASE IP NODENAME
ubuntu-with-iperf 16h Running 10.7.0.25 gke-vmkubed-cluster-3-kubevirt-48eff194-6jj7
$ virtctl console ubuntu-with-iperf
Can't connect to websocket (401): websocket: bad handshake

Regards,
Kranthi.

dvo...@redhat.com

unread,
Feb 3, 2022, 9:24:09 AM2/3/22
to kubevirt-dev
On Monday, January 31, 2022 at 3:01:37 AM UTC-5 kra...@aveshasystems.com wrote:
Hi all,

In EKS Cluster I am able to connect to the console but in GKE Cluster its not working. I am able to get the vms, as well as all other resources with it. I have tried the virtctl application but getting "Can't connect to websocket (401): websocket: bad handshake". Below are some examples of about issue. Please suggest me If there is any workaround.$ kubectl cluster-info

Interesting. 

One thing that might give us a clue here is understanding if any of the other virtctl commands that proxy through our virt-api server work. For instance, does `virtctl restart <vm name>` work?

Kranthi Kumar

unread,
Feb 3, 2022, 9:50:59 AM2/3/22
to kubevirt-dev
Hi David Vossel,

Thanks for the reply.

virtctl restart <vm name>` is also not working and getting below mentioned error.
Error restarting VirtualMachine the server has asked for the client to provide credentials

David Vossel

unread,
Feb 3, 2022, 9:58:42 AM2/3/22
to Kranthi Kumar, kubevirt-dev
On Thu, Feb 3, 2022 at 9:51 AM Kranthi Kumar <kra...@aveshasystems.com> wrote:
Hi David Vossel,

Thanks for the reply.

virtctl restart <vm name>` is also not working and getting below mentioned error.
Error restarting VirtualMachine the server has asked for the client to provide credentials


Using the same kubeconfig, do kubectl commands work? The error you're getting indicates that your client (in this case virtctl) can authenticate with the k8s api server. 
 



On Thursday, February 3, 2022 at 7:54:09 PM UTC+5:30 dvo...@redhat.com wrote:
On Monday, January 31, 2022 at 3:01:37 AM UTC-5 kra...@aveshasystems.com wrote:
Hi all,

In EKS Cluster I am able to connect to the console but in GKE Cluster its not working. I am able to get the vms, as well as all other resources with it. I have tried the virtctl application but getting "Can't connect to websocket (401): websocket: bad handshake". Below are some examples of about issue. Please suggest me If there is any workaround.$ kubectl cluster-info

Interesting. 

One thing that might give us a clue here is understanding if any of the other virtctl commands that proxy through our virt-api server work. For instance, does `virtctl restart <vm name>` work?
 

Kubernetes control plane is running at https://34.141.40.169
calico-typha is running at https://34.141.40.169/api/v1/namespaces/kube-system/services/calico-typha:calico-typha/proxy
GLBCDefaultBackend is running at https://34.141.40.169/api/v1/namespaces/kube-system/services/default-http-backend:http/proxy
KubeDNS is running at https://34.141.40.169/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Metrics-server is running at https://34.141.40.169/api/v1/namespaces/kube-system/services/https:metrics-server:/proxyTo further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
virt-launcher-ubuntu-with-iperf-848jn 3/3 Running 0 16h
$ kubectl get vmi
NAME AGE PHASE IP NODENAME
ubuntu-with-iperf 16h Running 10.7.0.25 gke-vmkubed-cluster-3-kubevirt-48eff194-6jj7
$ virtctl console ubuntu-with-iperf
Can't connect to websocket (401): websocket: bad handshake

Regards,
Kranthi.

--
You received this message because you are subscribed to a topic in the Google Groups "kubevirt-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/kubevirt-dev/zpUEUV4olY0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to kubevirt-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kubevirt-dev/049df4d8-8a9b-4431-ab03-1751173bcf03n%40googlegroups.com.

Kranthi Kumar

unread,
Feb 3, 2022, 10:15:29 AM2/3/22
to kubevirt-dev
Yes, Using the same kubeconfig, kubectl commands are working fine. 
$ kubectl get pods
NAME                                    READY   STATUS    RESTARTS   AGE
virt-launcher-ubuntu-with-iperf-848jn   3/3     Running   0          7d2h

$ kubectl get vmi
NAME                AGE    PHASE     IP          NODENAME
ubuntu-with-iperf   7d2h   Running   10.7.0.25   gke-vmkubed-cluster-3-kubevirt-48eff194-6jj7
Reply all
Reply to author
Forward
0 new messages