Typorithm · medium

Service Types

service-typeskubernetesservicenodeportloadbalancer
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn Service Types

0%

Networking

ClusterIP is internal-only, NodePort opens a high port on every node, and LoadBalancer provisions a cloud LB in front — each type adds reach on top of the one before.

ClusterIP exposes a Service only inside the cluster — the right default for service-to-service traffic.

NodePort opens a high port (30000-32767) on every node and forwards it to the Service, useful for quick external access or behind your own load balancer.

LoadBalancer asks the cloud provider for an external load balancer with a public IP, the usual choice for production internet-facing services.

01

ClusterIP: internal-only, the default.

02

NodePort: a high port on every node's IP.

03

LoadBalancer: a cloud-provisioned external IP.

apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  selector:
    app: web
  type: NodePort
  ports:
    - port: 80
      targetPort: 8080
      nodePort: 30080

Read the implementation

Connect each part of the code to the concept before you type.

1. Service type

NodePort opens a port on every node that forwards into the Service.

type: NodePort

2. Service port

port is the in-cluster Service port, same as ClusterIP.

port: 80

3. Container port

targetPort is the pod port that receives the forwarded traffic.

targetPort: 8080

4. Node port

nodePort is the external port (30000-32767) reachable on every node's IP.

nodePort: 30080

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

Service Types: Lesson & Practice · Typorithm | ApplyDjinn