How does localhost proxy works and how it differ from "normal/server proxy"

8/24/2019

As I learning Kubernetes, I found that a proxy can be made in front of Apiserver by the use a a "kube-proxy". I would like to know how localhost proxy works and how it is different in its process to the standard proxy, i.e, a proxy on another server.

According to me the first goal of a proxy is to change the ip of the caller but in case of localhost proxy the ip address is still the same as packet are coming from the same host; it will most act as a simple port redirection according to me. So lastly why using it ?

I'am totally lost

THANKS

-- Alfred hitchcock
kubernetes
localhost
networking
proxy

1 Answer

8/26/2019

I believe that you might have to distinguish different proxy approaches which can be used throughout Kubernetes cluster.

  1. kubectl proxy (link to the documentation pages) - this command creates proxy server between local machine and Kubernetes API Server, meaning that some local port will be forwarded to the remote API server port, thus you can reach some API static content via HTTP calls.

  2. Built-in Kubernetes api-server Discovery services - related to some exposed by default services managed by kube-system K8s resources, accessible from local machine.

  3. kube-proxy - kind of Kubernetes Service oriented proxy server, runs on every Node in K8s cluster and forward inbound traffic to backends Pods. Can be tuned up in the following modes: user-space, iptables and IPVS modes.

I encourage you also to get some more insights about proxy methods in the official Kubernetes documentation guidelines.

-- mk_sta
Source: StackOverflow