vcluster
vcluster copied to clipboard
Port forward does not work in vclusters
What happened?
I cannot do port forwarding in vcluster, if the kubeconfig is created via NodePort or proxied by Ingress. LoadBalancer and port-forward to local port and works fine.
What did you expect to happen?
I can open a port to the service/pod
How can we reproduce it (as minimally and precisely as possible)?
- Create a new vcluster
- Create a new NodePort that expose the vcluster k8s service
- Create a pod under the vcluster (nginx is a good example)
- Expose the port via
kubectl port-forwardunder the vcluster
Anything else we need to know?
Given 31503 is the node port exposed for the vcluster k8s service, it shows something like this:
(base) PS C:\Users\SteveFan> kubectl port-forward nginx-deployment-86dcfdf4c6-2qcsj 8080:80
error: error upgrading connection: unable to upgrade connection: error dialing backend: dial tcp 172.30.0.13:31503: connectex: A connection attempt failed because the connected party did not properly respond after a period of
time, or established connection failed because connected host has failed to respond.
Host cluster Kubernetes version
Should be irrelevant
Host cluster Kubernetes distribution
k0s v1.28.2+k0s
vlcuster version
Should be irrevelant
Vcluster Kubernetes distribution(k3s(default)), k8s, k0s)
k3s
OS and Arch
Client OS: Windows
Arch: x86_64
Hi, the vcluster version is very relevant as it proxies these requests. Please share :)
Also, which Ingress were you trying?
Working for me, will need details about the load balancer and your setup to continue investigating
Hi, the vcluster version is very relevant as it proxies these requests. Please share :)
Also, which Ingress were you trying?
okay the vcluster image version is 0.19.4. I used the cloudflare ingress controller and used cluster account authentication, it worked so well until i want to get a port forward or terminal connection.
NodePort seemingly worked, I just happened so that I got the wrong targetPort. But ingress seems still not working.
This is likely an issue with the ingress controller's configuration. Please ensure that your ingress controller supports upgrade connections and is configured for tls passthrough