kubectl port-forward address binding¶
kubectl port-forward address binding is a configuration option used in the Kubernetes command-line interface to define which network interface listens for the forwarded connection.^[400-devops__06-Kubernetes__k8s-mysql__README.md]
Usage¶
By default, kubectl port-forward typically binds to localhost (127.0.0.1), restricting access to the local machine. To allow external access to the forwarded port, the --address flag can be used to specify the binding address.^[400-devops__06-Kubernetes__k8s-mysql__README.md]
Example¶
The following command demonstrates forwarding a local port to a pod's MySQL port while binding to all available network interfaces (0.0.0.0).^[400-devops__06-Kubernetes__k8s-mysql__README.md]
[kubectl port-forward](<./kubectl-port-forward.md>) mysql-dp-8dfb795cf-2hkgm 3306:3306 --address 0.0.0.0
This configuration enables connections to the database from outside the immediate local host environment.^[400-devops__06-Kubernetes__k8s-mysql__README.md]
Related Concepts¶
- kubectl
- [[k8s-ithelp]]
Sources¶
^[400-devops__06-Kubernetes__k8s-mysql__README.md]