kubernetes tutorial | Network Namespaces | Linux Network Namespaces

Описание к видео kubernetes tutorial | Network Namespaces | Linux Network Namespaces

CERTIFIED KUBERNETES ADMINISTRATOR
-------------------------------------------------------------------------
kubernetes tutorial | Network Namespaces | Linux Network Namespaces

Description
----------------------

In this video, you are going to learn the concepts of kubernetes - Network Namespaces.
we are also going to see a demo on Network Namespaces as well.

*Kubernetes | Network Namespaces *
-----------------------------------------------------------

1. Linux Namespaces
2. Network, PID and Cgroup Namespaces
3. Namespaces & Containers
4. Network Namespaces
5. DEMO: Network Namespaces
6. Thank you


For suggestions/feedback/doubts contact
email: [email protected]

Happy Learning !!!

============================================================

USEFUL LINKS
----------------------------

Linux Namespaces

  / container-networking-under-the-hood-networ...  

https://dev.mysql.com/doc/refman/8.0/...


Network Namespaces and Cgroups

https://www.nginx.com/blog/what-are-n...


============================================================
#vsparkz #kubernetes #k8s #containers


DEMO STEPS
--------------------------

Network Namespaces

Step 1: Access the nodes and Inspect the existing network setup

$ ip link
$ ip addr

Step 2: Create a Network Namespaces (Red, Blue) & Virtual bridge_1 (Switch) in Node_1

$ ip netns add red
$ ip netns add blue
$ ip link add name vbridge-1 type bridge

Step 3: Create & attach VETH Pairs in Node_1

Create VETH Pairs

$ ip link add veth0-red-in type veth peer name veth0-red-out
$ ip link add veth0-blue-in type veth peer name veth0-blue-out

Attach one side to Network Namespaces

$ ip link set veth0-red-in netns red
$ ip link set veth0-blue-in netns blue

Attach other side to Virtual Bridge

$ ip link set veth0-red-out master vbridge-1
$ ip link set veth0-blue-out master vbridge-1


Step 4: Assign some IP's to the VETH pairs & Virtual Bridge_1 (No-Overlapping IP's)

$ ip netns exec red ip addr add 10.10.1.10/24 dev veth0-red-in
$ ip netns exec blue ip addr add 10.10.1.20/24 dev veth0-blue-in
$ ip addr add 10.10.1.1/24 dev vbridge-1


Step 5: Enable all the VETH pairs and Loopback interfaces

$ ip netns exec red ip link set dev veth0-red-in up
$ ip netns exec blue ip link set dev veth0-blue-in up

$ ip netns exec red ip link set dev lo up
$ ip netns exec blue ip link set dev lo up

$ ip link set veth0-red-out up
$ ip link set veth0-blue-out up
$ ip link set vbridge-1 up


Step 6: Add Default routes to the Network Namespaces to Reach the Physical Network

$ ip netns exec red ip route add default via 10.10.1.1
$ ip netns exec blue ip route add default via 10.10.1.1


Step 7: Add IP Table Rule & Forward the Host Traffic using SNAT (MASQUERADE)

$ iptables -t nat -A POSTROUTING -s 10.10.1.0/24 -j MASQUERADE
$ sysctl -w net.ipv4.ip_forward=1


Step 8: Repeat Above steps1-7 in Node_2

$ ip netns add green
$ ip link add veth0-green-in type veth peer name veth0-green-out
$ ip link add name vbridge-2 type bridge
$ ip link set veth0-green-in netns green
$ ip link set veth0-green-out master vbridge-2
$ ip netns exec green ip addr add 10.10.2.30/24 dev veth0-green-in
$ ip addr add 10.10.2.1/24 dev vbridge-2
$ ip netns exec green ip link set dev veth0-green-in up
$ ip netns exec green ip link set dev lo up
$ ip link set veth0-green-out up
$ ip link set vbridge-2 up
$ ip netns exec green ip route add default via 10.10.2.1
$ iptables -t nat -A POSTROUTING -s 10.10.2.0/24 -j MASQUERADE
$ sysctl -w net.ipv4.ip_forward=1


Step 9: Add routes for the namespace to namespace communication in different Nodes

Node_1: $ ip route add 10.10.2.0/24 via 192.168.74.14
Node_2: $ ip route add 10.10.1.0/24 via 192.168.74.13


Step 10: Test the connectivity between the Network Namespaces in different nodes

Node_1: $ ip netns exec blue ping 10.10.2.30
Node_2: $ ip netns exec green ping 10.10.1.20



THE END

Комментарии

Информация по комментариям в разработке