# Is there any Kubernetes port forwarding security concern?

**URL:** https://discuss.kubernetes.io/t/is-there-any-kubernetes-port-forwarding-security-concern/14748
**Category:** General Discussions
**Created:** [February 8, 2021, 9:02pm UTC](https://discuss.kubernetes.io/t/is-there-any-kubernetes-port-forwarding-security-concern/14748 "2021-02-08T21:02:33Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![limetree](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/limetree/32/6491_2.png) [@limetree](https://discuss.kubernetes.io/u/limetree)
#### Post date: [February 8, 2021, 9:02pm UTC](https://discuss.kubernetes.io/t/is-there-any-kubernetes-port-forwarding-security-concern/14748/1 "2021-02-08T21:02:33Z")

</div>

Asking for help? Comment out what you need so we can get more information to help you!

### Cluster information:

Kubernetes version: v1.17  
Cloud being used: (put bare-metal if not on a public cloud)  
Installation method:  
Host OS:  
CNI and version:  
CRI and version:

I am researching on whether there is security concern with Kubernetes port forwarding and common or best practice with it. Would you someone share thoughts? Thanks.

Below are my thought. Please correct me or provide information. Thanks.

I think port forwarding is a common practice, and as long as the localhost to which the pod port is forwarding is safe -in internal network behind firewall – should be fine.

Also, it seems the tunnel/route for access is(also questions here):

1. localhost:localport → api server (through http or https? how to enable https here or mechanic to security security)
2. from api server → Kubelet? (this should be common route, so no concern here?)

---

<div class="post-metadata">

### Author: ![limetree](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/limetree/32/6491_2.png) [@limetree](https://discuss.kubernetes.io/u/limetree)
#### Post date: [February 9, 2021, 9:52pm UTC](https://discuss.kubernetes.io/t/is-there-any-kubernetes-port-forwarding-security-concern/14748/2 "2021-02-09T21:52:45Z")

</div>

To add to my questions above, if the pod is a tiller pod, whether there will be a security concern? Any thoughts are welcome.

---

<div class="post-metadata">

### Author: ![mrbobbytables](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/mrbobbytables/32/7_2.png) [@mrbobbytables](https://discuss.kubernetes.io/u/mrbobbytables)
#### Post date: [February 10, 2021, 12:49pm UTC](https://discuss.kubernetes.io/t/is-there-any-kubernetes-port-forwarding-security-concern/14748/3 "2021-02-10T12:49:10Z")

</div>

Your access is still limited by whatever RBAC permissions are in play.  
Explicit access to port-forwarding can be enabled with granting access to the resource `pods/portforward`.

> [@limetree](#):
>
> 1. localhost:localport → api server (through http or https? how to enable https here or mechanic to security security)
> 2. from api server → Kubelet? (this should be common route, so no concern here?)

This is done using tls

> [@limetree](#):
>
> To add to my questions above, if the pod is a tiller pod, whether there will be a security concern? Any thoughts are welcome.

Tiller is generally granted privileged access, however that has been a large pain point. Helm as a project has moved away from tiller for the myriad of issues (security being a big one of them) associated with it.

---

<div class="post-metadata">

### Author: ![limetree](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/limetree/32/6491_2.png) [@limetree](https://discuss.kubernetes.io/u/limetree)
#### Post date: [February 10, 2021, 10:22pm UTC](https://discuss.kubernetes.io/t/is-there-any-kubernetes-port-forwarding-security-concern/14748/4 "2021-02-10T22:22:45Z")

</div>

Thank you very much, Mrbobbytables, for explaining this to me!

---

<div class="post-metadata">

### Author: ![Michael\_Call](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.kubernetes.io/michael_call/32/9127_2.png) [@Michael\_Call](https://discuss.kubernetes.io/u/Michael_Call)
#### Post date: [December 14, 2021, 3:33pm UTC](https://discuss.kubernetes.io/t/is-there-any-kubernetes-port-forwarding-security-concern/14748/5 "2021-12-14T15:33:28Z")

</div>

Is communication from localhost to the API server always done using TLS? I have a case where I have a cluster with microservices with APIs that are exposed to the internet, each microservice in its own deployment, but one microservice has an API that’s only accessible from within the cluster. If I port-forward to a pod in that cluster-only deployment I can hit the API but I want to know if my requests to localhost:myport/some/path are encrypted or not. Is that a setting that needs to be explicitly set or does port-forward always encrypt that communication?
