_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Container Networking v Kubernetes

28. 07. 2024 1 min read intermediate

DevOps Intermediate

Container Networking v Kubernetes

KubernetesNetworkingCNIIngress 6 min read

Kubernetes networking model. CNI pluginy, Service types, Ingress controllery a DNS.

K8s Network Model

Každý pod má vlastní IP adresu. Základní pravidla:

  • Každý pod může komunikovat s každým podem (bez NAT)
  • Nody mohou komunikovat s pody (bez NAT)
  • IP, kterou pod vidí sám u sebe = IP viditelná ostatním

CNI Pluginy

  • Calico — BGP routing, network policies, široce používaný
  • Cilium — eBPF-based, vysoce výkonný, advanced network policies
  • Flannel — jednoduchý overlay, vhodný pro začátečníky
  • Weave — mesh network, šifrovaný
# Cilium instalace
helm install cilium cilium/cilium \
  --namespace kube-system \
  --set hubble.enabled=true \
  --set hubble.relay.enabled=true \
  --set hubble.ui.enabled=true

Service Types

# ClusterIP — interní (default)
apiVersion: v1
kind: Service
spec:
  type: ClusterIP
  selector:
    app: api
  ports:
    - port: 80
      targetPort: 8080

# NodePort — přístup přes port na nodu
spec:
  type: NodePort
  ports:
    - port: 80
      nodePort: 30080

# LoadBalancer — cloud LB
spec:
  type: LoadBalancer
  ports:
    - port: 443

Ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: api-ingress
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
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-server
                port:
                  number: 80

Summary

K8s networking je flat model s pod-to-pod komunikací. CNI plugin volte podle potřeb: Cilium pro eBPF performance, Calico pro network policies.

Need Help with Implementation?

Our team has experience designing and implementing modern architectures. We’re happy to help.

Free Consultation

Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.