AskLearn
Loading...
← Back to Course
Advanced

Networking

Pod communication and ingress

Networking

Pod-to-Pod Communication

  • Pods can communicate directly using IP addresses
  • Each pod gets its own IP address
  • Containers within a pod communicate via localhost

Service Networking

  • Services provide stable endpoints for pods
  • DNS-based service discovery
  • Service names resolve to service IPs

Ingress

Manages external access to services, typically HTTP/HTTPS.

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

Network Policies

Control traffic flow between pods.

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
  name: deny-all
spec:
  podSelector: {}
  policyTypes:
  - Ingress
  - Egress

Next Steps

Learn about Security to secure your Kubernetes applications.