我正在使用K8S HPA -Horizontal Pod Autoscaler。事情正如预期的(如下所述-https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale-walkthrough/)
如果我删除部署kubectl delete deploy php-apache
删除部署,则删除POD。但是HPA条目仍在那里进行部署。当没有部署对象时,此条目的意义是什么?
逻辑意义上的水平POD自动基督教徒是一个控制循环,该控制循环检查其指定的目标(例如部署),以查看是否满足了度量阈值。(这实际上是通过控制器管理器和指标API发生的)。HPA是其自己的独立资源,它通过称为Scale subresource
的东西与部署进行交互。这是一个抽象,是作为Kubernetes可能希望自动缩放的任何未来资源的接口(不仅仅是部署)。
水平吊舱自动制剂的规范(取自K8S设计文档):
type HorizontalPodAutoscalerSpec struct {
// reference to Scale subresource; horizontal pod autoscaler will learn the current resource
// consumption from its status,and will set the desired number of pods by modifying its spec.
ScaleRef SubresourceReference
// lower limit for the number of pods that can be set by the autoscaler, default 1.
MinReplicas *int
// upper limit for the number of pods that can be set by the autoscaler.
// It cannot be smaller than MinReplicas.
MaxReplicas int
// target average CPU utilization (represented as a percentage of requested CPU) over all the pods;
// if not specified it defaults to the target CPU utilization at 80% of the requested resources.
CPUUtilization *CPUTargetUtilization
}
请注意,HPA使用比例参考来针对所需的资源,而部署则通过其选择器包含多个资源。出于灵活性原因,HPA与特定部署分离。这意味着,当您删除部署时,K8可以通过其选择器删除其管理的所有内容。HPA不受部署管理,而仅通过其自己的规范连接到它。HPA可以保留,等待新的部署占据原始位置,可以重新配置,也可以删除。