Kind of related to that restarting,
there's another useful command.
Let's say we don't have auto scaling in place.
So Kubectl will not automatically
create more or less pods
but we know that we'll have more traffic incoming.
So we don't just want to have this pod and this container
up and running once
but let's say three times.
We can achieve this by running kubectl scale.
Then we need to specify what we wanna scale.
And here we could say deployment/first-app.
This is how we identified this deployment.
And then we add the dash dash replica's option.
To specify how many instances,
how many pods we wanna have.
For example, you could set this two free.
And if we do that,
we run cube control get pods,
we see free pots for our first app deployment here,
The pods which we had before and two new pods.
Of course, we also see that here
in our dashboard here in the browser,
we see our new pods here as well,
and they are running the same container as the other pod.
Now because we have a load balancer,
traffic will also be distributed evenly
across these different pods
and the containers running in there.
To see this in action.
Let me go back to our application and visit this page.
And now let's visit slash error and have crashes.
Let me go back to the other page and it works.
Now it works even though this pod here
is still terminated at the moment,
it will eventually restart.
But of course now to traffic was simply redirected
to another pod.
Now, if I crashed as again,
we see another pod crashed,
but again, we got one other pot up and running here.
So you can tell that the traffic is definitely not just
going to one and the same pot all the time,
but that it is being distributed across our different pods.
So scaling, even if it doesn't happen automatically,
is another very useful feature we get with Kubernetes.
Of course, we can also scale it down to one replica again,
by repeating the kubectl controlled scale command
and setting replica's to one.
If we do that and we run Q control get pods thereafter,
we see two pods are terminating
and only one pod will stay up and running.
And therefore eventually the other two pods here
will be gone after some time.
So scaling is a never useful feature.