A container tunnel network creates a separate network plane for containers by using tunnel encapsulation on the host network plane. This network model uses VXLAN for tunnel encapsulation and Open vSwitch as the virtual switch backend. VXLAN is a protocol that encapsulates Ethernet packets into UDP packets to transmit them through tunnels. Open vSwitch is an open-source virtual switch that provides functions such as network isolation and data forwarding.
While there may be some performance costs, packet encapsulation and tunnel transmission allow for greater interoperability and compatibility with advanced features, such as network policy-based isolation, in most common scenarios.
Figure 1 Container tunnel network

In a cluster using the container tunnel model, the communication paths between pods on the same node and between pods on different nodes are different.
Advantages
Disadvantages
The container tunnel network allocates pod IP addresses according to the following rules:
Figure 2 IP address allocation of the container tunnel network

Maximum number of nodes that can be created in the cluster using the container tunnel network = Number of IP addresses in the container CIDR block/Size of the IP CIDR block allocated to the node by the container CIDR block at a time (16 by default)
For example, if the container CIDR block is 172.16.0.0/16, the number of IP addresses is 65,536. If the mask of the container CIDR block allocated to each node is 28 (a total of 16 pod IP addresses allocated each time), a maximum of 4,096 (65536/16) nodes can be created. This is an extreme case. If 4,096 nodes are created, a maximum of 16 pods can be created for each node because only a CIDR block with 16 IP addresses is allocated to each node. The number of nodes that can be added to a cluster is also determined by the available IP addresses in the node subnet and the scale of the cluster.
As explained in Cluster Network Structure, there are three networks in a cluster: cluster network, container network, and Service network. When planning network addresses, consider the following:
The following is an example of creating a workload in a cluster using the container tunnel network model:
Create the deployment.yaml file. The following shows an example:
kind: DeploymentapiVersion: apps/v1metadata:name: examplenamespace: defaultspec:replicas: 4selector:matchLabels:app: exampletemplate:metadata:labels:app: examplespec:containers:- name: container-0image: 'nginx:perl'resources:limits:cpu: 250mmemory: 512Mirequests:cpu: 250mmemory: 512MiimagePullSecrets:- name: default-secret
Create the workload.
kubectl apply -f deployment.yaml
kubectl get pod -owide
Command output:
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATESexample-5bdc5699b7-5rvq4 1/1 Running 0 3m28s 10.0.0.20 192.168.0.42 <none> <none>example-5bdc5699b7-984j9 1/1 Running 0 3m28s 10.0.0.21 192.168.0.42 <none> <none>example-5bdc5699b7-lfxkm 1/1 Running 0 3m28s 10.0.0.22 192.168.0.42 <none> <none>example-5bdc5699b7-wjcmg 1/1 Running 0 3m28s 10.0.0.52 192.168.0.64 <none> <none>
You can access a pod using its IP address within the pod or from a node in the cluster. In the following example, access a pod's IP address within the pod. example-5bdc5699b7-5rvq4 is the pod name, and 10.0.0.21 is the pod IP address.
kubectl exec -it example-5bdc5699b7-5rvq4 -- curl 10.0.0.21
If the following information is displayed, the workload can be accessed:
<!DOCTYPE html><html><head><title>Welcome to nginx!</title><style>body {width: 35em;margin: 0 auto;font-family: Tahoma, Verdana, Arial, sans-serif;}</style></head><body><h1>Welcome to nginx!</h1><p>If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.</p><p>For online documentation and support please refer to<a href="http://nginx.org/">nginx.org</a>.<br/>Commercial support is available at<a href="http://nginx.com/">nginx.com</a>.</p><p><em>Thank you for using nginx.</em></p></body></html>