0

A few months back I was able to access a port on my pod using the url /api/v1/namespaces/namespace/pods/podname:port/proxy/path/

But after upgrading GKE I consistently get a 400 Bad Request with no further explanation. The same approach still works on Docker Desktop, Azure AKS and Amazon EKS.

Other api calls appear to work fine, such as /api/v1/namespaces/namespace/secrets.

Anyone got the same problem and have a solution for it?

1 Answers1

0

The API endpoint should be /api/v1/namespaces/{namespace}/pods/{name}/proxy/{path}. port should not be included in the URL.

You may also want to check the podname. The name may have changed after upgrade as it's a redeploy.

Gari Singh
  • 11,418
  • 2
  • 18
  • 41
  • 1. This used to work in GKE a few months back 2. According to the documentation both protocol and port are optional parts of the URL: ": - proxies to the specified port name or port number using http" : https://kubernetes.io/docs/tasks/access-application-cluster/access-cluster/#discovering-builtin-services – Martin Skarsaune Dec 01 '21 at 22:13
  • With regards to changed pod name: The pod name comes from an API call to list pods right before constructing the URL. I can with other tools see that the pod still exists – Martin Skarsaune Dec 01 '21 at 22:20
  • In your first comment, you mention ":" which is for Services not Pods. Do you wants pods or services? – Gari Singh Dec 02 '21 at 10:13
  • The snippet from the documentation only says services, however the syntax also works for pods. That is the case in kubernetes for Docker Desktop (Mac), Azure AKS, Amazon EKS, and some months back also for GKE. – Martin Skarsaune Dec 03 '21 at 11:38