/images/avatar.png

Kubernetes CNI Weave

Install Weave Net Weave Net You can check Weave Net official installation. 1 kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')" Weave Net Objects POD List 1 kubectl -n kube-system get pods | grep weave DaemonSet 1 kubectl -n kube-system get ds | grep weave Weave Net IPAM(IP Address Management) IPAM Types Type Description DHCP Dynamic Host Configuration Protocol host-local Localhost Check Default Gateway of Another Node 1 2 3 4 5 # Structure kubectl -n <namespace> exec <pod-name> -- <command> # Example kubectl -n kube-system exec weave-net-gcjhh -- ip route 1 2 3 4 5 6 Defaulting container name to weave.

Kubernetes Cluster Network

Kubernetes Cluster Network Ports Required Ports Check Official Ports Kubernetes Network Model Plugins Plugins You need to check the Official Document And I’m going to post how to install each plugin. Find Configured Network Interface Check Internal IP of Master Node 1 kubectl get nodes -o wide 1 2 3 NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME controlplane Ready control-plane,master 10m v1.20.0 10.96.191.3 <none> Ubuntu 18.04.5 LTS 5.

Kubernetes Container Networking Interface

Network Namespaces CNI(Container Network Interface) in CRI(Container Runtime Interface) BRIDGE Command 1 2 3 4 5 # Structure bridge add <cid> <namespace> # Example bridge add 2e34dcf34 /var/run/netns/2e34dcf34 Bridge Process CRI(Container Runtime Interface) Products Process CNM(Container Network Model) for Docker Docker CNM is CNI of docker. CNM is different with others CNI. Models Docker Network 1 2 3 4 5 # There's no network type 'cni-bridge' in docker #docker run --network=cni-bridge nginx # RUN docker run --network=none nginx Bridge 1 bridge add 2e34dcf34 /var/run/netns/2e34dcf34 CNI(Container Network Interface) Products CNI in Kubernetes CNI Config in kubelet Option Description Default Example –network-plugin Plugin cni cni –cni-conf-dir Plugin config directory /etc/cni/net.

Docker Network

Docker Network Mode Mode Command Description NONE docker run --network none nginx The container is isolated. HOST docker run --network host nginx The container uses host network. BRIDGE docker run nginx The container uses bridge network that. NONE NONE The containers are being isolated. So they can’t connect out of the container. 1 2 docker run --network none nginx docker run --network none nginx HOST HOST The containers are running on host network, so the containers are using same ports between host and containers.

Network Namespace

Process Namespace 1 ps aux 1 2 3 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.1 21852 11328 ? Ss 05:34 0:01 /sbin/init root 1659 0.0 0.0 968 4 ? Ss 05:34 0:00 /pause PID PID that is above, that is a process namespace. In above example, 1 and 1659. Network Namespace Routing Table A Routing Table, or RIB(Routing Information Base), is a data table stored in a router or a network host that lists the routes to particular network destinations, and in some cases, metrics (distances) associated with those routes.