Simple question but I haven't find any clear answer yet... Is the concept of a Docker network, single-host or multi-host, the same thing as the Kubernetes concept of Namespace?
Kubernetes namespace is just for users to manage their workload easily. For instance, you can have two service with exact same name in two namespaces but have two different internal DNS names (kubernetes adds namespace as part of dns name). Furthermore, with multi tenants you can use RBAC to separate each tenant for their access.
However docker networking is just a network mode that how containers talk with other and kubernetes use the container networking mode of docker network.
They are very different.
A docker network is a regular network that transfers packets between containers and used by containers to communicate with the host (through the docker0
bridge and a veth
pair).
a kubernetes namespace is a logical way to isolate / divide / separate cluster resources between multiple users and provides scope for names.
As I understand
Namespaces: Namespaces are virtual clusters that can sit on top of the same k8s cluster.Purpose of Namespaces to provide logical separation between the teams and their environments. For example, If there are multi-tier applications which has numerous pods, therefore, it helps pod-to-pod communication using the same namespace.Now by having another namespace same multi-tier application can be deployed on the same k8s cluster without interference or contradictions. Therefore, It provides a logical isolation.
Docker Network: It answers how 2 or more containers communicate with each other on the same Host.
As Kubernetes provides several networking solutions.for example flannel,calico, which has different purposes.
I have attached a link for further research on comparison.
networking-solutions-for-kubernetes
Kubernetes approaches networking somewhat differently than Docker does by default. There are 4 distinct networking problems to solve.