liveBook · Manning

Node port

As explained in Google Anthos in Action

NodePort is a Kubernetes Service type that exposes a service through a port on each cluster node.

NodePort is a Kubernetes Service type that exposes a Service through a port on each cluster node. In hybrid or multicloud Anthos GKE networking, a load balancer sends traffic to the node IP and NodePort, which forwards it to the selected Pod port. section 10.3.2

A NodePort deployment involves these operational steps:

  • Create or identify a Deployment and expose it as a NodePort Service. section 12.3.1
  • Inspect the assigned Service port and cluster address with kubectl. section 12.3.1
  • Use a load balancer and Service VIP when resources outside the cluster must reach the Service. section 10.3.2
  • Prefer an Ingress controller when one VIP must route to multiple Services through HTTP rules. section 10.3.2

Previewing a NodePort Service with minikube

Start minikube, create the hello-minikube Deployment, and expose it with `kubectl expose deployment hello-minikube --type=NodePort --port=8080`. Check the assigned port with `kubectl get services hello-minikube`, then forward it locally with `kubectl port-forward service/hello-minikube 8080:8080` and open `http://localhost:8080`. section 12.3.1

Figure 10.15 Anthos GKE hybrid multicluster networking
10-15

Trace the hybrid multicluster path from a Service VIP through the load balancer and NodePort to the destination Pod. section 10.3.2

How Google Anthos in Action covers it

How deep it goes
Explains load-balancer, node, and Pod forwarding, then demonstrates creation, inspection, and local port forwarding.
Examples
Uses Anthos GKE hybrid networking and a minikube hello-minikube Deployment exposed on port 8080.
What it assumes
Assumes familiarity with Kubernetes Deployments, Services, Pods, kubectl, and either an Anthos GKE or minikube environment.
What you can do after
Operate/configure NodePort Services with kubectl and route external traffic through a load balancer or local port forwarding.
How it connects
Connects NodePort to Kubernetes Services, Pods, Deployments, load balancers, Service VIPs, and Ingress controllers.

Also explained in

Compare how 6 books explain node port →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Google Anthos in Action. The section links point to the parts of the book it draws on.