Networking
Prerequisites
Network Namespaces
ip netns add redip netns add blueip netnsip link add veth-red type veth peer name veth-blueip link set veth-red netns redAssigning IP Addresses
Activating the Network Interfaces
When network namespaces increase, its not efficient to do previous steps for each one, so we use Linux bridge to connect multiple network namespaces
Connecting Namespaces to the Bridge:
Enabling Communication from the Host to Namespaces:
Docker Networking
Docker Network Types
Key Commands
Important Concepts
CNI
How CNI Works
CNI with Container Runtimes
Cluster Networking


Lab (IMPORTANT):
Here is the most useful stuff discovered:

If you want to view a single interface information run:

If you want to view network bridges:

To view routing and get the default gateway:

View port information:


Pod Networking
Kubernetes defined requirements for pod networking which are:

When we create the bridge on a node, we must create a script to attach pods to the bridge:
To run this script automatically when a pod gets created, here is where CNI comes in to play and we must follow its standards:


CNI in Kubernetes
The CNI plugin is configured in the kubelet service on each node in the cluster:

You can view same information running:

The CNI bin directory has all the supported CNI plugins as executables:

The CNI config directory has set of configuration files which the kubelet looks at to find which plugin to be used:


Lab:
View CNI plugins:
View CNI plugin configured to be used in current cluster:
CNI Weave
Use the below latest link to install the weave net:
The pod consists of two containers:
You can check the status of Weave Net pods just like any other pod in Kubernetes using:
Lab:

Then to check what this pod used as a default gateway run:
Service Networking



To view rules created by kube-proxy:

Also, we can view kube-proxy logs:

Lab:
To get pods IP address range, check the CNI used and run:

To get services IP address range:

CoreDNS in Kubernetes
Let's say we have 2 pods and we want them to resolve each other:





Lab:
Ingress
Deploying Ingress Controller
Ingress Resource
Ingress resource to route all traffic to a backend service:
Path Based Routing:

Hostname Based Routing:

Rewrite target
Lab 1:
Faster way of creating ingress resource:
Lab 2:
Slides
Last updated
