<p><code>kubectl proxy</code> and <code>kubectl port-forwarding</code> look similar and confusing to me, what are their main differences and use cases?</p>

Dagang
<p>As mentioned in "<a href="https://stackoverflow.com/a/51469150/6309">How <code>kubectl port-forward</code> works?</a>"</p>

<blockquote>
  <p><code>kubectl port-forward</code> forwards connections to a local port to a port on a pod. </p>
  
  <p>Compared to <code>kubectl proxy</code>, <code>kubectl port-forward</code> is more generic as it can forward TCP traffic while <code>kubectl proxy</code> can only forward HTTP traffic.</p>
</blockquote>

<p>As an example, see "<a href="https://medium.com/pixelpoint/kubernetes-port-forwarding-simple-like-never-before-20a8ab16370f" rel="noreferrer">Kubernetes port forwarding simple like never before</a>" from <a href="https://twitter.com/alex_barashkov" rel="noreferrer">Alex Barashkov</a>:</p>

<blockquote>
  <p><strong>Port forwarding mostly used for the purpose of getting access to internal cluster resources and debugging</strong>.</p>
  
  <p>How does it work?</p>
  
  <p>Generally speaking, using port forwarding you could get on your ‘localhost’ any services launched in your cluster.<br>
  For example, if you have Redis installed in the cluster on 6379, by using a command like this:</p>

<pre><code>kubectl port-forward redis-master-765d459796-258hz 7000:6379
</code></pre>
  
  <p>you could forward Redis from the cluster to localhost:7000, access it locally and do whatever you want to do with it.</p>
</blockquote>

<p>For a limited HTTP access, see kubectl proxy, and, as an example, "<a href="https://blog.heptio.com/on-securing-the-kubernetes-dashboard-16b09b1b7aca" rel="noreferrer">On Securing the Kubernetes Dashboard</a>" from <a href="https://twitter.com/jbeda" rel="noreferrer">Joe Beda</a>:</p>

<blockquote>
  <p>The easiest and most common way to access the cluster is through kubectl proxy. This creates a local web server that securely proxies data to the dashboard through the Kubernetes API server.</p>
</blockquote>

<p>As shown in "<a href="https://medium.com/edureka/kubernetes-dashboard-d909b8b6579c" rel="noreferrer">A Step-By-Step Guide To Install &amp; Use Kubernetes Dashboard</a>" from <a href="https://twitter.com/edurekaIN" rel="noreferrer">Awanish</a>:</p>

<blockquote>
<pre><code>kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml
</code></pre>
  
  <p>Accessing Dashboard using the kubectl</p>

<pre><code>kubectl proxy
</code></pre>
  
  <p>It will proxy server between your machine and Kubernetes API server.</p>
  
  <p>Now, to view the dashboard in the browser, navigate to the following address in the browser of your Master VM:</p>

<pre><code>http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
</code></pre>
</blockquote>
