3

I have a question regarding Kubernetes networking.

I know that in Docker swarm if I want to run different containers on different servers, I need to create an overlay network, and then all the containers (from all the servers) will be attached to this network and they can communicate with each other (for example, I can ping from container A to container B).

I guess that in Kubernetes there isn't an overlay network - but another solution. For example, I would like to create 2 Linux containers on 2 servers (server 1: ubuntu, server 2: centos7), so how do the pods communicate with each other if there isn't an overlay network?

And another doubt - can I create a cluster which consists of windows and Linux machines with kubernetes? I mean, a multi platform kubernetes which all the pods communicate with each other.

prashanth kumar
  • 136
  • 1
  • 2
  • 8

3 Answers3

1

The topic can easy cover multiple pages, so let me try to address the basics while providing pointers for further reading.


To understand how containers/pods communicate in Kubernetes one has to understand what pod and service is.

Kubernetes pods - A Kubernetes pod is a group of containers that are deployed together on the same host.

Kubernetes service - It can be defined as an abstraction on the top of the pod which provides a single IP address and DNS name by which pods can be accessed.


Communication between containers in the same pod.

Containers within the same pod share an IP address and port space and can find each other via localhost, thus no specific networking configuration is needed. Note that all containers in given pod are scheduled on the same Kubernetes node.

Communication between pods.

Communication between pods is done using kubernetes service. Once you have service defined for given pod, other pods can find it using the service name.

To make analogue between Docker Swarm and Kubernates: In order to configure networking, in Docker Swarm you will define network, while in Kubernetes you will define service.

Running mixed (Windows/Linux) load on Kubernetes.

This is possible as long as you schedule your load on specific node i.e. Linux containers on Linux nodes and Windows containers on Windows nodes. Please see the answer to this question for additional details.

0
  1. There is overlay network in Kubernetes. Ex: Calico. Read more here.

  2. In Kubernetes, we create pods, and pods have containers which run container images - which can be Linux or windows images. So Kubernetes can run multi-platform containers.

prashanth kumar
  • 136
  • 1
  • 2
  • 8
0

Kubernetes has overlay network Kubernetes defines a network model called the container network interface (CNI), but the actual implementation relies on network plugins. The network plugin is responsible for allocating internet protocol (IP) addresses to pods and enabling pods to communicate with each other within the Kubernetes cluster. There are a variety of network plugins for Kubernetes, but this article will use Flannel. Flannel is very simple and uses a Virtual Extensible LAN (VXLAN) overlay by default.

You often hear about overlay networks in the context of Kubernetes networking. While this may sound complicated, an overlay network simply involves another layer of encapsulation for network traffic. For example, the Flannel network plugin takes traffic from a pod and encapsulates it inside the VXLAN protocol. This article takes a deep dive into how this encapsulation works and how the traffic appears on the wire.