Skip to main content
🎤 Luca Berton is speaking at Red Hat Summit & KubeCon EU 2026!Learn more →
Back to Blog

Kubernetes Services and Ingress

Expose Kubernetes workloads with ClusterIP, NodePort, LoadBalancer services and Ingress controllers. Practical examples.

Luca BertonApril 14, 20261 min read

Service Types

ClusterIP (Default)

Internal-only. Other pods in the cluster can reach it by name.

yaml
apiVersion: v1
kind: Service
metadata:
  name: api
spec:
  selector:
    app: api
  ports:
    - port: 80
      targetPort: 3000
bash
# Access from another pod
curl http://api.default.svc.cluster.local
# Or just
curl http://api

NodePort

Exposes the service on every node's IP at a static port (30000-32767):

yaml
apiVersion: v1
kind: Service
metadata:
  name: api
spec:
  type: NodePort
  selector:
    app: api
  ports:
    - port: 80
      targetPort: 3000
      nodePort: 30080

Access at http://:30080.

LoadBalancer

Creates a cloud load balancer (AWS ALB/NLB, GCP LB, Azure LB):

yaml
apiVersion: v1
kind: Service
metadata:
  name: api
spec:
  type: LoadBalancer
  selector:
    app: api
  ports:
    - port: 80
      targetPort: 3000
bash
kubectl get svc api
# EXTERNAL-IP shows the load balancer address

When to Use Which

TypeUse Case
ClusterIPInternal microservice communication
NodePortDevelopment, bare-metal clusters
LoadBalancerProduction cloud deployments (one LB per service)
IngressProduction (one LB, multiple services via routing)
Related Course

Master this topic with hands-on labs

Go beyond reading — build real projects in sandboxed environments with expert video guidance.

Browse Courses →

Ingress

Route external traffic to multiple services through a single load balancer:

yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: app-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  ingressClassName: nginx
  rules:
    - host: api.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: api
                port:
                  number: 80
    - host: app.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: frontend
                port:
                  number: 80

Install Ingress Controller

Ingress resources need a controller to work:

bash
# Nginx Ingress Controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.10.0/deploy/static/provider/cloud/deploy.yaml

# Verify
kubectl get pods -n ingress-nginx

TLS with Ingress

yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: app-ingress
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
  ingressClassName: nginx
  tls:
    - hosts:
        - api.example.com
      secretName: api-tls
  rules:
    - host: api.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: api
                port:
                  number: 80
Stay Updated

Get weekly IT automation tips

Docker, Ansible, Terraform, MLOps — curated insights delivered to your inbox. No spam.

Subscribe Free →

Path-Based Routing

Route different paths to different services:

yaml
spec:
  rules:
    - host: example.com
      http:
        paths:
          - path: /api
            pathType: Prefix
            backend:
              service:
                name: api
                port:
                  number: 80
          - path: /
            pathType: Prefix
            backend:
              service:
                name: frontend
                port:
                  number: 80

Debugging Services

bash
# Check endpoints (pods backing the service)
kubectl get endpoints api

# No endpoints? Labels don't match
kubectl get pods --show-labels
kubectl describe svc api

# Test from inside cluster
kubectl run curl --image=curlimages/curl --rm -it -- curl http://api

# Check Ingress
kubectl describe ingress app-ingress
kubectl get ingress

- Kubernetes Pod Troubleshooting for pod issues - kubectl Cheat Sheet for DevOps for essential commands - Local Kubernetes with Kind for testing locally -e ---

Ready to go deeper? Explore our hands-on DevOps courses — from Docker and Terraform to MLflow on Kubernetes.

Ready to learn by doing?

Stop reading tutorials — start building. Expert video courses with hands-on labs in real sandboxed environments.

Share this article
LB
Luca Berton

Docker Captain, IT automation expert, Red Hat Summit & KubeCon speaker. Building hands-on education for DevOps engineers at CopyPasteLearn.

Related Articles

Explore topics

Browse more articles on the topics covered here.