In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to achieve automatic capacity expansion and reduction of Pod in kubernetes. I hope you will gain something after reading this article. Let's discuss it together.
One: brief introduction
Through the HPA controller, Kubernetes is used to realize the function of automatic Pod capacity expansion and reduction with basic CPU utilization. The HAP controller periodically detects the CPU utilization of the target Pod based on the Kube-controller-manager service startup parameter of Master-the duration defined by horizontal-pod-autoscaler-sync-period (the default is 30s), and adjusts the number of Pod replicas in ReplicationController or Deployment when the conditions are met to meet the user-defined average Pod CPU utilization. Pod CPU usage comes from Heapster components, all need to be pre-installed with Heapster.
Second: the creation of HPA
You can create a HPA quickly using the kubectl autoscale command or using a Yaml configuration file. Before creating a HPA, a Deployment/RC object needs to exist, and the Pod in the Deployment/RC must define the resource request value of the resources.requests.cpu. If you do not set this value, the Heapster will not be able to collect the CPU usage of the Pod, which will cause the HPA to fail to work properly.
For example:
1.kubectl autoscale deployment php-apache-min=1-max=10-cpu-percent=50
two。 Create from a yaml file
ApiVersion: autoscaling/v1
Kind: HorizontalPodAutoscaler
Metadata:
Name: php-apache
Spec:
ScaleTargetRef:
ApiVersion: apps/v1beta1
Kind: Deployment
Name: php-apache
MinReplicas: 1
MaxReplicas: 10
TargetCPUUtilizationPercentage: 50
After reading this article, I believe you have a certain understanding of "how to achieve automatic expansion and reduction of Pod in kubernetes". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.