Search code examples
kubernetesgoogle-kubernetes-enginegke-networking

Unable to port-forward in private GKE cluster


I have a private cluster in GKE which I access through Bastion host. Everything works except port-forwarding workloads (services). I suspect the issue is the private cluster and something to do with networking. The cloud console does not have the option to port forward as well. What may have caused this issue? Any idea would be great. Thanks

Network Configuration of the Cluster

No port-forwarding option is visible No Portword Option

EDIT: My goal is to get the port-forwarding commands easily accessible through the cloud console like in the picture below.

We have another cluster that was configured earlier. In it, I can see the debug / port-forwarding option side-by-side with the Ports. With Visible port-forwdin option


Solution

  • I have created a private cluster in my cloud console and deployed a service but the port forward option is enabled for me.

    Below is my cluster configuration: enter image description here

    Below are the service details:

    enter image description here

    Can you try changing the target port as 80 and try again

    • You can port-forward the web preview while using the GCP shell to do port forwarding.
    • When attempting port-forwarding from the shell, run command kubectl port-forward and use the web preview option.
    • You will see the output on the port you are forwarding and be redirected to a web preview.
    • For further information see GCP official doc and blog by Refine.