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

7

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

9

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 10

5. Types of services:

Click here for Offical docs 11

1. Cluster IP:

alt text

  • 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 alt text

3. Loadblancer:

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

15

ExternalName

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

16

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

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

Please turn AdBlock off
Animated Social Media Icons by Acurax Responsive Web Designing Company

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube