Advanced Networking in Kubernetes

Load balancing, Networking plugins, CNI

Docker Networking

Containers are launched on Docker bridge
Docker Inner Host Networking (Doesn’t have interconnectivity between node for pod-pod communication)

CNI (Container Network Interface)

Interface between container to network
It is in JSON format
Identify network to attach container
Assign IPs to pods
3rd party plugins: VLAN, MacVLAN, Weave, Calico, Contiv

Kubernetes Networking

IP address of containers change on reboot# Service
Static entry
Monitors pod

Types of Services

kubectl get pods -o wide      # to see internal IP addresses of pods

Services expose internal IP to the outside world ( Each pod will have a separate service if pods are of different types )

Until service is mentioned, pods can’t talk to each other

kubectl get svckubectl expose pod nginx-pod --type ClusterIP --port 80 --target-port 80            # --port = service port, --target-port = pod portkubectl describe svc nginx-pod

Service has static IP address

Service monitors the pod and does Health Checks
If the pod restarts with the same label, label selector matching happens and all IP of pods with same label are stored in the service monitor

Kube-dns

For name registering kube-dns is used

Converting ClusterIP to NodePort

kubectl edit svc nginx-pod
# change service and save it

LB ip -> node ip:node port -> service ip:service port -> pod ip:target port-> container port

Ingress

Ingress Resource - contains rules 
Ingress Controller - reading rules and processing data
kubectl get ingress

Consultant