[v0.24] vCluster connect background proxy is not port-forwarding to the localhost (WSL + Docker Desktop)
What happened?
Hi, i have a problem with vcluster v0.24.x that makes me unable to connect to the vcluster in my remote cluster. I can connect just fine in vcluster v0.23.x before.
Here's the details of my local environment and logs:
OS: Windows 11 running WSL2 (Ubuntu 22.04) Docker: v28.0.4 running using docker desktop
$ vcluster version
vcluster version 0.24.1If I run the connect command, it's unable to connect to the vcluster in the remote cluster
$ vcluster connect vcluster-staging -n vcluster-staging --debug
11:34:49 debug Found vCluster vcluster-staging/vcluster-staging
11:34:49 debug Successfully found vCluster pod for connecting vcluster-staging-0
11:34:49 done vCluster is up and running
11:34:49 debug Successfully retrieved vCluster kube config
11:34:49 info Stopping background proxy...
11:34:50 info Starting background proxy container...
11:34:50 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
11:34:50 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
11:34:50 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
11:34:50 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
11:34:51 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
11:34:51 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
11:34:51 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
11:34:51 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
11:34:51 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
11:34:52 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
11:34:52 debug failed to list default service account Get "https://127.0.0.1:12228/api/v1/namespaces/default/serviceaccounts/default": dial tcp 127.0.0.1:12228: connect: connection refused
^I noticed Starting background proxy container here, so I run docker ps and find that the port is not forwarded in my case
That's the reason that I'm unable to connect; the port has not been forwarded to my localhost. Again, this happened after I upgraded to version 0.24.x, it was working fine in v0.23.x
I also try to run using service account. It seems to run fine at first, but the same issue occurs when I'm running kubectl get ns
$ vcluster connect vcluster-staging -n vcluster-staging --service-account admin --cluster-role cluster-admin
11:57:15 done vCluster is up and running
11:57:16 info Stopping background proxy...
11:57:16 info Starting background proxy container...
11:57:16 info Create service account token for kube-system/admin
11:57:18 done Switched active kube context to vcluster_vcluster-staging_vcluster-staging_269504772373670133-cb5fb81a92dad4b638af7d734a46ee145
- Use `vcluster disconnect` to return to your previous kube context
- Use `kubectl get namespaces` to access the vcluster
$ kubectl get namespaces
E0429 11:57:57.857810 45897 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"https://127.0.0.1:12900/api?timeout=32s\": dial tcp 127.0.0.1:12900: connect: connection refused"
E0429 11:57:57.859682 45897 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"https://127.0.0.1:12900/api?timeout=32s\": dial tcp 127.0.0.1:12900: connect: connection refused"
E0429 11:57:57.863896 45897 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"https://127.0.0.1:12900/api?timeout=32s\": dial tcp 127.0.0.1:12900: connect: connection refused"
E0429 11:57:57.866098 45897 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"https://127.0.0.1:12900/api?timeout=32s\": dial tcp 127.0.0.1:12900: connect: connection refused"
E0429 11:57:57.867596 45897 memcache.go:265] "Unhandled Error" err="couldn't get current server API group list: Get \"https://127.0.0.1:12900/api?timeout=32s\": dial tcp 127.0.0.1:12900: connect: connection refused"
The connection to the server 127.0.0.1:12900 was refused - did you specify the right host or port?Please let me know if you need more details. Thank you.
What did you expect to happen?
I can connect to vcluster using vcluster v0.24.x or above
How can we reproduce it (as minimally and precisely as possible)?
- Test in the same environment that I have (I mentioned it above)
- Install vCluster v0.24.x
- Try to connect to your vcluster using
vcluster connect vcluster-staging -n vcluster-staging --debugcommand
Anything else we need to know?
I'm using this workaround for now to be able to connect to my vcluster. But I hope that this issue can be fixed so I can connect only using vcluster cli just fine like before
Workaround:
- Manual port forward from vcluster pod
$ kubectl port-forward -n vcluster-staging pod/vcluster-staging-0 8443:8443- Switch the context manually to your vcluster
$ kubectl config use-context vcluster_vcluster-staging_vcluster-staging_269504772373670133-cb5fb81a92dad4b638af7d734a46ee145
Switched to context "vcluster_vcluster-staging_vcluster-staging_269504772373670133-cb5fb81a92dad4b638af7d734a46ee145".- Run
kubectl get namespaces
Host cluster Kubernetes version
$ kubectl version
Client Version: v1.32.3
Kustomize Version: v5.5.0
Server Version: v1.32.1-aliyun.1vcluster version
$ vcluster --version
vcluster version 0.24.1VCluster Config
controlPlane:
distro:
k8s:
enabled: true
backingStore:
database:
embedded:
enabled: true
statefulSet:
persistence:
volumeClaim:
size: 20Gi
storageClass: "alicloud-disk-topology-alltype"Source: loft-sh/vcluster