DevOps Classroom notes 13/Oct/2026

Kuberentes Networking

1. Golden rule in K8s Networking

  • Every pod has its own ip address
  • Every pod will comunicate with another pod without NAT
  • k8s have its own route table

2. CNI (container network Interface)

  • k8s does not implement any networkinmg itself
  • it is dellegated to CNI plugins
  • every CNI Having its own specifications + plugins
    • ex: Callico, flannel , aws vpc, azure vnet …etc
curl -O https://raw.githubusercontent.com/projectcalico/calico/v3.33.0/manifests/calico.yaml

kubectl apply -f calico.yaml

3.Never depends on POD IPAddess:

  • pod are ephemeral: they can die and recreate
  • pod ip will change on every recreate

4.Service and Kube-proxy

Service is provider which will be provide static ip addresss (Cluster IP address), lb (Backend service)

Service: IP 
Backend: # LAbels of the pod 
    podA
    PodB
    Podc

Kube-porxy

  • kube dns <service>.namespace.cluster.ingress.local
  • its runs on every node

5. Types of services:

Click here for Offical docs

1. Cluster IP:

  • it will static ip adress for ny master node
  • to access application we need to cluster IP and port of serivce
  • Internal microserices (pod) call

2. Node port

  • It similar as cluster ip but it used node ipaddrsss
  • it used for connect from externally
  • outsides testing

3. Loadblancer:

  • this configure with your loadbalancer
  • loadbalancer or dns LB is required
  • used for external access applications

ExternalName

  • it is used for inside cluster
  • It will create dns record

cluster.ingress.local  ==> domain
servicename.namespace.cluster.ingress.local:9092  ==> subdomain

Example for ClusterIp and NodePort:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: recreate-deployment-app
  labels:
    app: apache2
spec:
  replicas: 2
  selector:
    matchLabels:
      app: apache2
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: apache2
    spec:
      containers:
        - name: apache2
          image: httpd:2 # 2.4.69
          ports:
            - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  name: service-recreate
  labels:
    app: apache2
spec:
  type: ClusterIP
  selector:
    app: apache2
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080

---

apiVersion: v1
kind: Service
metadata:
  name: service-recreate-1
  labels:
    app: apache2
spec:
  type: NodePort
  selector:
    app: apache2
  ports:
    - protocol: TCP
      port: 80
      nodePort: 30010

Task

look for K8s ingress controller

Create sample deployment and try Cluster Ip and node port service to access Application

# To test clsuter IP 
kubectl port-forward svc/<service-name> <local-port>:<service-port>
kubectl port-forward svc/service-recreate 8080:8080

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%