HTTP requests directly to pod in k8s cluster using k8s go-client

Viewed 56

What I need to do is to make request without forwarding the port to the HTTP server located in k8s pod.

I have tried to make this request:

res := clientset.CoreV1().RESTClient().Get().
    Namespace("default").
    Resource("pods").
    Name("my_pod_name:8080").
    SubResource("proxy").
    Suffix("api").
    Do(context.Background())

and it is working for simple HTTP GET but I also need to pass headers and query parameters and I cannot do it using SetHeader.

Does a better solution/client exist for that case?

0 Answers
Related