19.06.2021 Views

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 13 ■ Using Autoscaling

./kubectl autoscale rc php-apache --cpu-percent=100 --min=3 --max=10

The deployment is autoscaled and an HPA is created, as shown in Figure 13-11.

Figure 13-11. Creating a horizontal pod autoscaler

List the HPA:

./kubectl get hpa

The single HPA should be listed as shown in Figure 13-12. The TARGET column lists the target CPU

utilization, the CURRENT column lists the current CPU utilization, the MINPODS column lists the minimum

number of pods, and the MAXPODS lists the maximum number of pods. Because the CPU utilization takes a

while to be monitored by heapster, the CURRENT column is indicating a value of <waiting>.

Figure 13-12. Listing the horizontal pod autoscaler

List the pods. The number of pods has increased from 1 in the initial deployment to 3 (the minimum

number of pods in the HPA) as shown in Figure 13-13.

Figure 13-13. Number of pods scaled to the minimum number of pods in the horizontal pod autoscaler

List the HPA again, and the CURRENT CPU utilization is at 0% as no load is being put on the

deployment as shown in Figure 13-14.

305

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

Saved successfully!

Ooh no, something went wrong!