Kubernetes port-forwarding for dev

kubernetes

Hey everybody, thanks for signing up for my email list. I’m going to try to send something out at least weekly.

This first newsletter I want to highlight a very useful Kubernetes feature that I started leveraging recently: port forwarding.

You can bind a port from a kubernetes cluster to your development machine you can hit private endpoints on your kubernetes cluster.

In the past week I’ve used it to access private endpoints and leverage a datadog agent that was on a cluster but not on my local development machine.

Here’s an example of how to do it:

$ kubectl get pods -A
...
$ kubectl port-forward <pod-name> <local port>:<remote port>

Now, whenever you hit localhost:, you’ll be hitting the container in your cluster.

For more information, see the documentation.