I am learning containers and microservices. This question might be basic. Lets us assume I have a microservice running on a container in my PC. I would like to know what happens during a container scale up and scale down. Please explain with a example
Your microservice might run as a number of replicated containers, each performing the same function. For example, if you have a web service, instead of just a single web server, you might have multiple web servers, each running as a container and serving the same web page. You would then also have a load balancer in front of these replicas that forwards incoming requests to any of these containers.
The reason for doing this is to increase the capacity of your microservice. If a single web server can serve 10 requests per second, then 10 web servers together can serve 100 requests per second. So, you increase the total capacity of your service to 100 requests per second.
Now, scaling up/down simply means increasing/decreasing the number of replica containers. For example, you can scale up to 20 replicas, which increases the total capacity of your service to 200 requests per second. If you don't need that much capacity and want to save resources, you could scale the application down to 5 replicas, which decreases the capacity to 50 requests per second.
In Kubernetes, the containers run as Pods, the object that manages a set of replicated Pods is a Deployment, and the load balancer is a Service.
I will assume from the tone of the question that this is a more design question, And the fact that you have tagged both kubernetes and docker I will assume you are planning to use or are already using this to some extent.
Ok now to the premise of the question, considering you have a microservice or in this case, it is interchangeable with a docker container that is running on your machine or VM.
So now what does it mean to scale the service
In Docker
docker stop id
In Kubernetes