← Services532 / 640
hardkubectl

Create a NodePort service that forwards traffic to a specified target port

command

kubectl create service nodeport SERVICE --tcp=PORT:TARGET_PORT

also accepted

kubectl create service nodeport

Command breakdown

Part of the Kubernetes CLI (kubectl) — Services category.

kubectlcreateservicenodeportSERVICE--tcp=PORT:TARGET_PORT
FlagPurpose
--tcpSet to: PORT:TARGET_PORT

Test your recall — not just your reading.

Practice with interactive quiz →