shlogg · Early preview
Cheedge Lee @cheedge

Kubernetes Networking Basics: Services, Ports, And Ingress

Kubernetes basics: SVC, NodePort, ClusterIP, Ingress & NetworkPolicy. Expose services with `kubectl expose`, access with `curl` and port-forwarding. Understand ingress rules, YAML files and network policies for secure traffic flow.

Quick recap for network. Details can click the title link or check the official doc.

  
  
  SVC

  
  
  1. create


# target port: listening port inside container
# port: service internal port
# NodePort: expose external port
kubectl expose deployment nginx --name nginx-svc --port 8081 --target-port 80 --type [NodePort|ClusterIP]
# --dry-run=client -oyaml

    
    

    
    




  
  
  2. curl


# on node
curl localhost:NodePort   # NodePort
curl NODE_IP:NodePort     # NodePort
curl SVC_IP:SVC_Port      # ClusterIP
# in other pod (ClusterIP)
curl SVC_NAME:SVC_Port
curl SVC_IP:SVC_Port...