For troubleshooting purposes for example, we could send messages directly to the application running inside the pod through the API server.
If we don't want to deal with the authentications and the certificates, we could use an HTTP proxy to communicate with our pods.
We start the HTTP proxy using the below command:
The above command finds the API-server and performs the authentication for us.
Our communication with the API-server goes through the HTTP proxy first before being handed over to the pod.
Instead of using the usual address of the API-server "apiServer:port", we will use the following address "localhost:8001".
To communicate with a pod, we use the below command:
Since the command "kubectl proxy" runs in the foreground and "monopolizes" the terminal, we could either type the above command in another terminal, or run the "kubectl proxy" command in the background using the "&" character as below:
The request is sent to the pod through the API-server, but we are connecting to the API-server using the kubectl proxy.
The above command complete path changes depending on the application inside the pod.