Skip to main content
Kubernetes Networking: Services, Ingress, and Network Policies

Kubernetes Networking: Services, Ingress, and Network Policies

KU
• 1 min read•29 views

Understand Kubernetes networking: ClusterIP, NodePort, LoadBalancer, Ingress, and policy.

Kubernetes networking can be confusing. Here’s a concise guide to services, ingress, and network policy.

Services

  • ClusterIP: Internal cluster DNS; default for in-cluster traffic.
  • NodePort: Expose a port on every node; good for dev or legacy.
  • LoadBalancer: Cloud LB per service; use when you need a dedicated external IP.

Ingress

  • Ingress = HTTP(S) routing (host/path) to backend services. You need an Ingress controller (e.g. nginx, AWS ALB).
  • TLS: Terminate at ingress; use cert-manager for certificates.
yaml.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: myapp
spec:
  ingressClassName: nginx
  rules:
    - host: myapp.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: myapp
                port: { number: 80 }

Network Policies

  • NetworkPolicy restricts pod-to-pod and pod-to-external traffic. Default-deny and allow only what’s needed.
  • Start with a policy that allows DNS and ingress; then add app-specific rules.

Best practice: document your ingress and network policy approach so every new service follows the same pattern.

React
Share this post
KU

Kiril Urbonas

AI Engineer

553 articles
View all articles by Kiril Urbonas

You might have missed

Evergreen posts worth revisiting.