Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Node port forwarding Concept in Kubernetes

In Kubernetes, the concept of “node port forwarding” allows you to access a service running on a specific node in your cluster. It enables you to access services or pods that are not directly exposed externally or are running on a specific node for testing or debugging purposes.

Here’s an explanation of node port forwarding with examples:

1. Forwarding a local port to a pod:

kubectl port-forward <pod-name> <local-port>:<pod-port>Code language: HTML, XML (xml)

Example command:

kubectl port-forward my-pod 8080:80Code language: CSS (css)

This command forwards local port 8080 to port 80 of the my-pod pod. You can then access the pod’s service locally using localhost:8080.

2. Forwarding a local port to a service:

kubectl port-forward service/<service-name> <local-port>:<service-port>Code language: HTML, XML (xml)

Example command:

kubectl port-forward service/my-service 8080:80

This command forwards local port 8080 to port 80 of the my-service service. You can access the service locally using localhost:8080.

3. Forwarding a local port to a specific node:

kubectl port-forward <node-name> <local-port>:<node-port>Code language: HTML, XML (xml)

Example command:

kubectl port-forward node/my-node 8080:80

This command forwards local port 8080 to port 80 of the my-node node. You can access any services or pods running on that node locally using localhost:8080.

4. Forwarding a local port to a pod with address binding:

kubectl port-forward --address <address> <pod-name> <local-port>:<pod-port>Code language: HTML, XML (xml)

Example command:

kubectl port-forward --address 192.168.0.100 my-pod 8080:80Code language: CSS (css)

This command forwards local port 8080 to port 80 of the my-pod pod, binding it to the IP address 192.168.0.100. You can then access the pod’s service using 192.168.0.100:8080.

5. Forwarding a local port to a service with address binding:

kubectl port-forward --address <address> service/<service-name> <local-port>:<service-port>Code language: HTML, XML (xml)

Example command:

kubectl port-forward --address 192.168.0.100 service/my-service 8080:80

This command forwards local port 8080 to port 80 of the my-service service, binding it to the IP address 192.168.0.100. You can access the service using 192.168.0.100:8080.

By specifying the --address option followed by the desired IP address, you can bind the port forwarding to that specific address. This can be useful in scenarios where you have multiple network interfaces or want to access the forwarded service or pod using a specific IP.

Please note that the IP address specified must be reachable from the machine where you’re running the kubectl command. Make sure the address is valid and accessible in your network environment.

Remember to replace <address>, <pod-name>, <service-name>, and the port numbers with your actual values when using port forwarding with address binding.

Node port forwarding is particularly useful for accessing services or pods that are not directly exposed externally, such as for debugging or troubleshooting purposes. It allows you to establish a direct connection to a specific node in the cluster and access the desired service or pod. Remember to replace <pod-name>, <service-name>, or <node-name> with the actual names of the pods, services, or nodes you want to forward ports for, and specify the appropriate local port and target port numbers.

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
MotoShare.in is your go-to platform for adventure and exploration. Rent premium bikes for epic journeys or simple scooters for your daily errands—all with the MotoShare.in advantage of affordability and ease.

Related Posts

List of containerized storage orchestration in Kubernetes

List of Containerized Storage Orchestration Solutions in Kubernetes (2026 Edition) Kubernetes has become excellent at orchestrating stateless applications, but stateful workloads still need a proper storage layer….

Read More

Understanding Authentication & Authorization in kubernetes

Authentication – How User’s access should be allowed? The process or action of verifying the identity of a user or process.Authorization – What Access and till what…

Read More

Kubernetes 1.23.6 Cluster Setup Master and Worker in Ubuntu 20.04

Latest doc – https://github.com/certifications-tutorials/kubernetes-cluster-setup Following commands would help you to create 1 Master and 1 Node in same VM. Run Following commands in Master Node Run following…

Read More

Kubernetes PersistentVolume, PersistentVolumeClaim, volume using hostPath

pv.yaml $ kubectl create -f pv.yaml $ kubectl get pv pvc.yaml $ kubectl create -f pvc.yaml $ kubectl get pvc pod.yaml Rajesh Kumar I’m a DevOps/SRE/DevSecOps/Cloud Expert…

Read More

Kubernetes: Working with ReplicationController

A ReplicationController is a Kubernetes controller that ensures that a specified number of pod replicas are running at any one time. In other words, a ReplicationController makes…

Read More

Kubernetes Tutorials: Pod Load balancing using Service

In Kubernetes, a Service is an abstraction that defines a logical set of pods and a policy by which to access them. It provides a stable network…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x