LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Containers
User Name
Password
Linux - Containers This forum is for the discussion of all topics relating to Linux containers. Docker, LXC, LXD, runC, containerd, CoreOS, Kubernetes, Mesos, rkt, and all other Linux container platforms are welcome.

Notices


Reply
  Search this Thread
Old 01-27-2021, 06:18 AM   #1
hesisaboury
Member
 
Registered: Dec 2010
Location: iran
Posts: 199

Rep: Reputation: 0
container scaling and load balancing traffic


Hi,
For one container everything is clear (connect to kafka or other services), but now I scale it up to 5 containers, here is my question, how traffic is load balancing between containers ?

THX
 
Old 01-28-2021, 12:55 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
There are many container technologies, and many container load balancing technologies. You need to provide some information about your configuration. For example, are you using Linux Containers? Docker? Virtuozzo? Proxmox? Kubernetes? Mesos? Docker Swarm?

A few other question you may want to address: How is the application implemented? How do you scale up? What does "load" mean in the context of your application?
 
Old 01-29-2021, 10:47 AM   #3
hesisaboury
Member
 
Registered: Dec 2010
Location: iran
Posts: 199

Original Poster
Rep: Reputation: 0
I'm using kubernetes ( service ) , there are multiple endpoints
 
Old 01-29-2021, 03:59 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
How do you scale up? Can you share the manifests?
 
Old 01-30-2021, 12:37 PM   #5
hesisaboury
Member
 
Registered: Dec 2010
Location: iran
Posts: 199

Original Poster
Rep: Reputation: 0
I used HPA , like this
kubectl autoscale deployment bserver --cpu-percent=50 --min=1 --max=10

and it works, under the stress, here I wanted to know how the Kube balance traffic among the new containers, and is there any other approach for load balancing?

Last edited by hesisaboury; 01-30-2021 at 12:47 PM.
 
Old 01-30-2021, 07:57 PM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
The autoscaler and the deployment abstraction don't balance load. You need a service to do that, or implement your own load balancing.
 
Old 01-31-2021, 01:44 AM   #7
hesisaboury
Member
 
Registered: Dec 2010
Location: iran
Posts: 199

Original Poster
Rep: Reputation: 0
I'm using service, plus autoscaling. I defined a service for one of my microservices and I wanted in case of high load, it scales up to 5. so others still see that microservice through that service I defined, my question is : how traffic is load balancing among those 5 containers? and is there any other way to change it.

I'm not sure, but it seems kube-proxy is load balancing among containers (L4 round robin ) and also there is no way to change it

Last edited by hesisaboury; 01-31-2021 at 02:13 AM.
 
Old 01-31-2021, 08:27 PM   #8
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Which type is the service?
 
Old 02-02-2021, 03:00 AM   #9
hesisaboury
Member
 
Registered: Dec 2010
Location: iran
Posts: 199

Original Poster
Rep: Reputation: 0
It's a cluster Service, with multiple endpoints
 
Old 02-02-2021, 03:38 AM   #10
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
It's not possible to help you if you don't provide information about your setup. If, for example, the service is of type loadbalancer, it uses load balancing functionality of the cloud in which the K8s cluster is running.

You may also have defined an ingress, which also performs load balancing.
 
Old 02-12-2021, 04:33 AM   #11
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: RHEL/Ubuntu/Debian/Fedora/Centos/K3OS
Posts: 1,159
Blog Entries: 4

Rep: Reputation: 149Reputation: 149
As suggested by berndbausch you can use any nginx ingress, istio, linkerd or traefik.
Let us know if you have K8s cluster or its a minikube/microk8s
If you want to know more about Services, Load Balancing, and Networking refer https://kubernetes.io/docs/concepts/...es-networking/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need suggestion for Deploying docker/Kubernetes for auto scaling/ load balancing pix9 Linux - Virtualization and Cloud 3 11-25-2015 06:38 AM
Network traffic load balancing nicklay Linux - Server 5 04-29-2013 10:53 AM
outbound web traffic load balancing across multiple nics univaco Linux - Networking 5 01-21-2009 01:25 PM
traffic shaping and link load balancing d4rksid3 Linux - Networking 7 10-22-2008 10:34 PM
Load Balancing Traffic Between Two Switches LinuxGeek Linux - Networking 3 04-11-2006 08:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Containers

All times are GMT -5. The time now is 06:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration