SlideShare una empresa de Scribd logo
1 de 18
Descargar para leer sin conexión
Service Discovery under Docker 1.12
Presenter Name : Ajeet Singh Raina
Presented Date: Aug 31, 2016
Presented at: Docker Online Meetup
2
ABOUT ME
#Contribution:
- Frequent Blogger – http://www.collabnix.com
- @Docker Captain
- Article Writing @ OSFY India
- Dell Community ( Containerizing Dell Legacy Application)
#Inside Dell:
- Project Lead Engineer(Global Solution Engineering)
- Worked in VMware, CGI , Dell R&D
- Solaris Lead Engineer ( Wiki Moderator)
• (t) – ajeetsraina (f) - Docker Public Group Moderator
#Reviewed Publications:
- Puppet for Containerization
- PowerCLI Cookbook
#Technology : Open Source Linux, Docker, Hadoop, Puppet
3
Agenda
• What’s new in Docker 1.12 Swarm Mode? – A Quick Recap
• Evolution of Service Discovery
• Definition of Service – An Approach to Service Discovery
• How Service Discovery works?
• A Quick Demo of Service Discovery
• Key Takeaways
4
What’s new in Docker 1.12?
5
Evolution of Service Discovery
Docker 1.9
/etc/hosts and /etc/resolv.conf
~ for the cluster service.
Disadvantage:
- Corrupted /etc/hosts
- Lacking of Load-Balancing
Feature
Complex way of Service
Discovery
Docker 1.10/1.11
- Embedded DNS
--network-alias=ALIAS
--link=CONTAINER_NAME:ALIAS
--dns=[IP_ADDRESS...]
--dns-search=DOMAIN
- Service Discovery through
External Discovery backend
like Consul, zookeeper etc.
Docker 1.12
- No External Service Discovery
Backend Required
- Service Discovery plumbed directly
into $docker service
- Service ~ A First Class Citizen
- Network is scope of discoverability.
- Service Discovery by Unqualified
names.(Un-FQDN)
- Provided by Embedded DNS
- Highly Available
- Ability to discover both the services
and tasks
-.
6
What is Service?
- A central structure and the primary root of user interaction with the Swarm System
- The definition of the tasks to execute on the worker nodes
- Tasks => workloads (container workloads as of now), Unikernel & VMs(in future)
Types
Global Services ( $docker service create –mode=global)
Replicated Services ( $docker service create –replicas 5)
Understanding Service Discovery
Cluster
node1
node3
node2
node4
node5
node6
node7
DB
DB
DBAPI
API
API
Web
Web
Web
API
Understanding Service Discovery
A Typical Swarm Cluster
node1
node3
node2
node4
node5
node6
node7
DB
DB
DBAPI
API
API
Web
Web
Web
API
9
Service Discovery
helps services find and talk to each other
Serviceа Serviceb
address
10
Service Discovery
helps service find and talk to each other
Serviceа Serviceb
Serviceb
Serviceb
Serviceb
Serviceb
Serviceb
Serviceb
Scaling
Scaling
DNS Request
generated by
container
11
How Embedded DNS resolve unqualified names?
$nslookup wordpressapp
$ping wordpressapp
$dig wordpressdb
Socket is created inside
the container
namespace
Send to random
UDP/TCP port
listening in Docker
daemon
Loopback address is
trapped
DNS Server identifies the
request via sockets
DNS Server is aware of the
context of the container
running that particular
service
Looks at /etc/resolv.conf
inside the container
$cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0
Creating a new
overlay network
12
Demonstrating Service Discovery under Swarm Mode
$docker network create 
-d overlay collabnet 
--subnet 10.0.3.0 
--opt encrypted
Creating a service
DNSRR VIP
$docker service create 
–endpoint-mode dnsrr 
-–name wordpressapp 
--replicas 5 
--network collabnet
$docker service create 
-–name wordpressapp 
--replicas 5 
--publish 80:80/tcp 
--network collabnet
Virtual IP (VIP)
Assignment to each
Service
$ docker service inspect 
--format=='{{json
.Endpoint.VirtualIPs}}' 
wordpressapp
{"NetworkID":"9eyjm4uv4ynmz
0aubfqxise29","Addr":"10.0.0.4/2
4"}]
VIP maps to DNS alias
The VIP(a private non-
routable IP which uses IPVS
LB) maps to a DNS alias
based upon the service
name.
DNS shared via
GOSSIP
Containers share DNS
mappings for the service
via GOSSIP
Service Discovery via
service Name
Any container on the
network can access the
service via its service
name
13
Demo
14
15
Network - the scope of Service Discoverability
Master-1 Node-1 Node-3Node-2
collabnet
wordpress
db.1
VIP(10.0.0.2)
wordpress
app.1
wordpress
app.5
wordpress
app.4
wordpress
app.2
wordpress
app.3
VIP(10.0.0.4)Wordpressapp
Wordpressdb
collabnet1
Wordpressdb
1.1
Wordpressdb1 VIP(10.0.1.2)
Services
16
17
Key Takeaways
Service Discovery:
• Service is now a first class citizen and plumbed directly into $docker service .
• Services can be published using two modes: VIP and DNSRR
• You can resolve a particular service by using its Unqualified names.
• You don't need to expose service-specific ports to make the service available to other services on the same
overlay network.
• Virtual IP is not going to change even if you scale out the services or bring down the containers running that
service.
• Trying to do: $ping VIP doesn’t work and is as designed. Technically, IPVS is a TCP/UDP load-balancer, while ping
uses ICMP and hence IPVS is not going to load-balance the ping request.
• For VIP based services the reason ping works on the local node is because the VIP is added a 2nd IP address on
the overlay network interface.
• When you use DNS-RR mode, services don't have a VIP allocated. Instead service names resolves to one of the
backend container IPs randomly.
• Service Discovery is scoped within a network.
Best ways to use Docker 1.12 Service Discovery by Docker Captain Ajeet Raina

Más contenido relacionado

Más de Docker, Inc.

Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
Docker, Inc.
 
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with BuildxVirtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Docker, Inc.
 

Más de Docker, Inc. (20)

How To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and ComposeHow To Build and Run Node Apps with Docker and Compose
How To Build and Run Node Apps with Docker and Compose
 
Hands-on Helm
Hands-on Helm Hands-on Helm
Hands-on Helm
 
Distributed Deep Learning with Docker at Salesforce
Distributed Deep Learning with Docker at SalesforceDistributed Deep Learning with Docker at Salesforce
Distributed Deep Learning with Docker at Salesforce
 
The First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker HubThe First 10M Pulls: Building The Official Curl Image for Docker Hub
The First 10M Pulls: Building The Official Curl Image for Docker Hub
 
Monitoring in a Microservices World
Monitoring in a Microservices WorldMonitoring in a Microservices World
Monitoring in a Microservices World
 
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
COVID-19 in Italy: How Docker is Helping the Biggest Italian IT Company Conti...
 
Predicting Space Weather with Docker
Predicting Space Weather with DockerPredicting Space Weather with Docker
Predicting Space Weather with Docker
 
Become a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio CodeBecome a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio Code
 
How to Use Mirroring and Caching to Optimize your Container Registry
How to Use Mirroring and Caching to Optimize your Container RegistryHow to Use Mirroring and Caching to Optimize your Container Registry
How to Use Mirroring and Caching to Optimize your Container Registry
 
Monolithic to Microservices + Docker = SDLC on Steroids!
Monolithic to Microservices + Docker = SDLC on Steroids!Monolithic to Microservices + Docker = SDLC on Steroids!
Monolithic to Microservices + Docker = SDLC on Steroids!
 
Kubernetes at Datadog Scale
Kubernetes at Datadog ScaleKubernetes at Datadog Scale
Kubernetes at Datadog Scale
 
Labels, Labels, Labels
Labels, Labels, Labels Labels, Labels, Labels
Labels, Labels, Labels
 
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment ModelUsing Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
Using Docker Hub at Scale to Support Micro Focus' Delivery and Deployment Model
 
Build & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWSBuild & Deploy Multi-Container Applications to AWS
Build & Deploy Multi-Container Applications to AWS
 
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
From Fortran on the Desktop to Kubernetes in the Cloud: A Windows Migration S...
 
Developing with Docker for the Arm Architecture
Developing with Docker for the Arm ArchitectureDeveloping with Docker for the Arm Architecture
Developing with Docker for the Arm Architecture
 
Sharing is Caring: How to Begin Speaking at Conferences
Sharing is Caring: How to Begin Speaking at ConferencesSharing is Caring: How to Begin Speaking at Conferences
Sharing is Caring: How to Begin Speaking at Conferences
 
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with BuildxVirtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
Virtual Meetup Docker + Arm: Building Multi-arch Apps with Buildx
 
DCSF 19 How Entergy is Mitigating Legacy Windows Operating System Vulnerabili...
DCSF 19 How Entergy is Mitigating Legacy Windows Operating System Vulnerabili...DCSF 19 How Entergy is Mitigating Legacy Windows Operating System Vulnerabili...
DCSF 19 How Entergy is Mitigating Legacy Windows Operating System Vulnerabili...
 
DCSF 19 Developing Apps with Containers, Functions and Cloud Services
DCSF 19 Developing Apps with Containers, Functions and Cloud ServicesDCSF 19 Developing Apps with Containers, Functions and Cloud Services
DCSF 19 Developing Apps with Containers, Functions and Cloud Services
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Best ways to use Docker 1.12 Service Discovery by Docker Captain Ajeet Raina

  • 1. Service Discovery under Docker 1.12 Presenter Name : Ajeet Singh Raina Presented Date: Aug 31, 2016 Presented at: Docker Online Meetup
  • 2. 2 ABOUT ME #Contribution: - Frequent Blogger – http://www.collabnix.com - @Docker Captain - Article Writing @ OSFY India - Dell Community ( Containerizing Dell Legacy Application) #Inside Dell: - Project Lead Engineer(Global Solution Engineering) - Worked in VMware, CGI , Dell R&D - Solaris Lead Engineer ( Wiki Moderator) • (t) – ajeetsraina (f) - Docker Public Group Moderator #Reviewed Publications: - Puppet for Containerization - PowerCLI Cookbook #Technology : Open Source Linux, Docker, Hadoop, Puppet
  • 3. 3 Agenda • What’s new in Docker 1.12 Swarm Mode? – A Quick Recap • Evolution of Service Discovery • Definition of Service – An Approach to Service Discovery • How Service Discovery works? • A Quick Demo of Service Discovery • Key Takeaways
  • 4. 4 What’s new in Docker 1.12?
  • 5. 5 Evolution of Service Discovery Docker 1.9 /etc/hosts and /etc/resolv.conf ~ for the cluster service. Disadvantage: - Corrupted /etc/hosts - Lacking of Load-Balancing Feature Complex way of Service Discovery Docker 1.10/1.11 - Embedded DNS --network-alias=ALIAS --link=CONTAINER_NAME:ALIAS --dns=[IP_ADDRESS...] --dns-search=DOMAIN - Service Discovery through External Discovery backend like Consul, zookeeper etc. Docker 1.12 - No External Service Discovery Backend Required - Service Discovery plumbed directly into $docker service - Service ~ A First Class Citizen - Network is scope of discoverability. - Service Discovery by Unqualified names.(Un-FQDN) - Provided by Embedded DNS - Highly Available - Ability to discover both the services and tasks -.
  • 6. 6 What is Service? - A central structure and the primary root of user interaction with the Swarm System - The definition of the tasks to execute on the worker nodes - Tasks => workloads (container workloads as of now), Unikernel & VMs(in future) Types Global Services ( $docker service create –mode=global) Replicated Services ( $docker service create –replicas 5)
  • 8. Understanding Service Discovery A Typical Swarm Cluster node1 node3 node2 node4 node5 node6 node7 DB DB DBAPI API API Web Web Web API
  • 9. 9 Service Discovery helps services find and talk to each other Serviceа Serviceb address
  • 10. 10 Service Discovery helps service find and talk to each other Serviceа Serviceb Serviceb Serviceb Serviceb Serviceb Serviceb Serviceb Scaling Scaling
  • 11. DNS Request generated by container 11 How Embedded DNS resolve unqualified names? $nslookup wordpressapp $ping wordpressapp $dig wordpressdb Socket is created inside the container namespace Send to random UDP/TCP port listening in Docker daemon Loopback address is trapped DNS Server identifies the request via sockets DNS Server is aware of the context of the container running that particular service Looks at /etc/resolv.conf inside the container $cat /etc/resolv.conf nameserver 127.0.0.11 options ndots:0
  • 12. Creating a new overlay network 12 Demonstrating Service Discovery under Swarm Mode $docker network create -d overlay collabnet --subnet 10.0.3.0 --opt encrypted Creating a service DNSRR VIP $docker service create –endpoint-mode dnsrr -–name wordpressapp --replicas 5 --network collabnet $docker service create -–name wordpressapp --replicas 5 --publish 80:80/tcp --network collabnet Virtual IP (VIP) Assignment to each Service $ docker service inspect --format=='{{json .Endpoint.VirtualIPs}}' wordpressapp {"NetworkID":"9eyjm4uv4ynmz 0aubfqxise29","Addr":"10.0.0.4/2 4"}] VIP maps to DNS alias The VIP(a private non- routable IP which uses IPVS LB) maps to a DNS alias based upon the service name. DNS shared via GOSSIP Containers share DNS mappings for the service via GOSSIP Service Discovery via service Name Any container on the network can access the service via its service name
  • 14. 14
  • 15. 15 Network - the scope of Service Discoverability Master-1 Node-1 Node-3Node-2 collabnet wordpress db.1 VIP(10.0.0.2) wordpress app.1 wordpress app.5 wordpress app.4 wordpress app.2 wordpress app.3 VIP(10.0.0.4)Wordpressapp Wordpressdb collabnet1 Wordpressdb 1.1 Wordpressdb1 VIP(10.0.1.2) Services
  • 16. 16
  • 17. 17 Key Takeaways Service Discovery: • Service is now a first class citizen and plumbed directly into $docker service . • Services can be published using two modes: VIP and DNSRR • You can resolve a particular service by using its Unqualified names. • You don't need to expose service-specific ports to make the service available to other services on the same overlay network. • Virtual IP is not going to change even if you scale out the services or bring down the containers running that service. • Trying to do: $ping VIP doesn’t work and is as designed. Technically, IPVS is a TCP/UDP load-balancer, while ping uses ICMP and hence IPVS is not going to load-balance the ping request. • For VIP based services the reason ping works on the local node is because the VIP is added a 2nd IP address on the overlay network interface. • When you use DNS-RR mode, services don't have a VIP allocated. Instead service names resolves to one of the backend container IPs randomly. • Service Discovery is scoped within a network.