Proxy
Since this is an HTTP-based application, we can also use the kubectl proxy command to get access to the responses from our code:
kubectl proxy
And the output will show something akin to the following:
Starting to serve on 127.0.0.1:8001
As a reminder, you won't get a prompt back in the Terminal window until the proxy terminates. Just as with the Python example, we can determine the URL to use that the proxy will use to forward to our container based on the Pod name and the namespace that we used when invoking the kubectl run command. Since we did not specify a namespace, it used the default, which is called default. The URL pattern for accessing the Pod is the same as the Python example:
http://localhost:8001/api/v1/proxy/namespaces/<NAME_OF_NAMESPACE>/pods/<POD_NAME>/ ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access