See the solution below with Step by Step Explanation.
Explanation:
Solution (Step by Step) :
1. Create a Horizontal Pod Autoscaler (HPA):
- use the 'kubectl create hpa' command to create an HPA named 'bookstore-hpa'
- Set the 'minRepIicas' to 2 and 'maxRepIic.as' to 5, defining the desired range of replicas.
- Set the 'targetCPlJLJtilizationPercentage' to 70, meaning the replica count will adjust when the average CPU utilization ot the pods crosses 70%.
- Specify the selector to match the 'bookstore-deployment' pods.

2. Apply the HPA: - Run 'kubectl apply -f bookstore-hpa.yamr to create the HPA. 3. Verify the HPA: - Check the status of the HPA using 'kubectl get hpa bookstore-hpa' 4. Observe Replica Adjustment: - Increase the load on the bookstore application to trigger the HPA scaling. - Monitor the replica count of the bookstore-deployment' using 'kL1bectl get deployments bookstore-deployment. You will observe the replica count automatically adjusting based on the CPL] utilization- 5. Customize Scaling Parameters: - You can customize the 'targetCPLJlJtilizationPercentage', 'minReplicas', and 'maxReplicaS in the HPA definition based on the application requirements and desired benavior.