19.06.2021 Views

148422597X Kubernetes Management Design Patterns [Vohra 2017-01-29] {E559F6BB}

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 13 ■ Using Autoscaling

Figure 13-8. Listing the pods

We shall invoke the service, which provides an external IP, to put load on the deployment and

test whether varying loads make the autoscaler alter the number of pods proportionately. Obtain the

LoadBalancer Ingress for the service:

./kubectl describe services php-apache | grep "LoadBalancer Ingress"

The public DNS at which the service may be invoked is listed, as shown in Figure 13-9.

Figure 13-9. Obtaining the LoadBalancer Ingress

Invoke the service using the Load Balancer Ingress. An output such as “OK!” is generated as shown

in Figure 13-10; the php-apache deployment is designed only for testing and more elaborate output is not

generated.

Figure 13-10. Invoking the LoadBalancer Ingress

Creating a Horizontal Pod Autoscaler

Next, we shall create a horizontal pod autoscaler for the deployment. An HPA can be created using one of

two available methods:

––

A HorizontalPodAutoscaler object

––

The kubectl autoscale command

The HorizontalPodAutoscaler specification provides the fields shown in Table 13-1.

303

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!