<p>Could somebody let me know,how the service discovery happening in docker swarm and kubernetes to understand the difference or even if any source like books or docs which explains this then share it</p>

JPNagarajan
<p>As I could find <a href="https://victorops.com/blog/kubernetes-vs-docker-swarm" rel="nofollow noreferrer">there</a> and <a href="https://vexxhost.com/blog/kubernetes-vs-docker-swarm-containerization-platforms/" rel="nofollow noreferrer">there</a></p>
<p><strong>Kubernetes vs. Docker Swarm</strong></p>
<blockquote>
<p>Docker Swarm and Kubernetes both offer different approaches to service discovery. In K8s you need to define containers as services manually. On the other hand, containers in Swarm can communicate via virtual private IP addresses and service names regardless of their underlying hosts.</p>
</blockquote>
<hr />
<blockquote>
<p>Kubernetes network is flat, as it enables all pods to communicate with one another. In Kubernetes, the model requires two CIDRs. The first one requires pods to get an IP address, the other is for services.</p>
<p>In a Docker Swarm, a node joining a cluster creates an overlay network of services that span all of the hosts in the Swarm and a host only Docker bridge network for containers. In Docker Swarm, users have the option to encrypt container data traffic when creating an overlay network by on their own.</p>
</blockquote>
<hr />
<blockquote>
<p>Kubernetes provides easy service organization with pods</p>
<p>With Kubernetes you don’t need to modify your application to use an unfamiliar service discovery mechanism. Kubernetes gives Pods their own IP addresses and a single DNS name for a set of Pods, and can load-balance across them.</p>
</blockquote>
<p><strong>Kubernetes</strong></p>
<p>There is example which provide informations about service discovery in <a href="https://platform9.com/blog/kubernetes-service-discovery-principles-in-practice/" rel="nofollow noreferrer">kubernetes</a>.</p>
<p>And more informations from <a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="nofollow noreferrer">kubernetes documentation</a>.</p>
<hr />
<p><strong>Docker swarm</strong></p>
<p>There is example which provide informations about service discovery in <a href="https://medium.com/quick-mobile/using-docker-swarm-to-do-service-discovery-and-deploy-like-a-god-ba5ef2be8094" rel="nofollow noreferrer">docker swarm</a>.</p>
<p>There is training about how to use <a href="https://training.play-with-docker.com/swarm-service-discovery/" rel="nofollow noreferrer">Service Discovery under Docker Swarm Mode</a>.</p>
<p>And some more informations from <a href="https://www.linux.com/tutorials/how-service-discovery-works-containerized-applications-using-docker-swarm-mode/" rel="nofollow noreferrer">linux tutorials</a>.</p>
