Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Docker Networking Tip - Load balancing options

8,644 views

Published on

This presentation covers different Load balancing options with Docker. Each option is illustrated with a demo.

Published in: Technology
  • Be the first to comment

Docker Networking Tip - Load balancing options

  1. 1. DOCKER NETWORKING TIPS Load Balance Options Presenter’s Name: Sreenivas Makam Associated Youtube video: https://youtu.be/aQmPqrHleJU
  2. 2. About me  Senior Engineering Manager at Cisco Systems Data Center group  Author of “Mastering CoreOS” https://www.packtpub.com/networking- and-servers/mastering-coreos/ )  Docker Captain(https://www.docker.com/community/docker-captains )  Blog: https://sreeninet.wordpress.com/  Projects: https://github.com/smakam  LinkedIn: https://in.linkedin.com/in/sreenivasmakam  Twitter: @srmakam
  3. 3. What is Service Discovery?  Allows micro services running as containers to discover each other automatically.  Components of Service Discovery  Health check – Identify healthy service  DNS – Maintain service name to IP mapping  Load balancer uses Service discovery database.  Standalone Service discovery software examples – Consul, etcd
  4. 4. Service Discovery in Docker  Service discovery is provided by DNS server available in Docker engine.  For unmanaged containers, container name resolves to container IP. Alias names can be also be used.  For services using service IP(endpoint mode=vip), service name resolves to service IP which in turn forwards the request to containers. In this case, ipvs based L4 load balancing is done.  For services using direct DNS(endpoint mode=dnsrr), service name directly resolves to container IP. In this case, DNS round robin load balancing is done.  Service Discovery is network scoped. Only containers in same network can discover each other.
  5. 5. L4 Load balancer does load balancing based on L3 and L4 fields. L7 Load balancer uses URL fields to load balance. Load balancer also supports advanced features like SSL/TLS termination, Content based routing, Access control and authorization, Rewrites and redirects, sticky session Example Load balancers are nginx, haproxy, traefik, ELB in AWS. What is Load balancing?
  6. 6.  For unmanaged containers, load balancing is done using simple round robin load balancing. Using aliases, a single alias can load balance to multiple unmanaged containers .  Docker takes care of load balancing internal services to the containers associated with the services.  For services using service IP(endpoint mode=vip), ipvs and iptables are used to load balance. This provides L4 based load balancing. Ipvs is Linux kernel load balancing feature.  For services using direct DNS(endpoint mode=dnsrr), DNS round robin balancing is used.  For services exposed externally, Docker uses routing mesh to expose the service on all Swarm nodes. Routing mesh uses “ingress” network to connect all nodes.  For HTTP based load balancing, HRM(HTTP Routing mesh) can be used. This is supported only with Docker EE.  Docker can also integrate with external load balancers like nginx, haproxy, traefik as well as cloud load balancers like ELB. Load balancing in Docker
  7. 7. Client (smakam/myubuntu) Web server (instavote/vote) Web server (instavote/vote) Swarm LB Service name Container IP Container IP Internal Load balancer Example: https://github.com/smakam/docker/tree/master/loadbalance/internal
  8. 8. Client (smakam/myubuntu) Service name DNS Service IP IP tables + IPVS Web server (instavote/vote) Web server (instavote/vote) Internal Load balancer - Details Example: https://github.com/smakam/docker/tree/master/loadbalance/internal
  9. 9. Ingress Network Web server (instavote/vote) Web server (instavote/vote) Swarm LB Service name Container IP Container IP Host name/IP: Port Ingress Load balancer Example: https://github.com/smakam/docker/tree/master/loadbalance/ingress
  10. 10. Sandbox IP Host name/IP: Port Ingress sandbox IP tables + IPVS Web server (instavote/vote) Web server (instavote/vote) NAT Ingress Load balancer - Details Example: https://github.com/smakam/docker/tree/master/loadbalance/ingress
  11. 11. Nginx Proxy LB Web server (instavote/vote) Web server (instavote/vote) Swarm LB Service name Container IP Container IPRedirect Ingress + Swarm LBHost name/IP: Port Proxy Load balancer Example: https://github.com/smakam/docker/tree/master/loadbalance/proxy
  12. 12. Ingress + Swarm LB Web server (nginx) Web server (instavote/vote) Traefik/ UCP LBRedirect Host name/IP: Port Web server (instavote/vote) Web server (nginx) /web /vote “vote” service “Web” service L7 Load balancer Example: https://github.com/smakam/docker/tree/master/loadbalance/traefik
  13. 13. References  White paper on Docker networking  HRM and UCP White paper  Docker blogs by me  Docker Networking – common issues and troubleshooting techniques

×