[英]Kubernetes HPA : Send HPA logs as events to aws cloudwatch
I am working on EKS cluster in AWS.我正在 AWS 中开发 EKS 集群。 We have an application, which is memory intensive.我们有一个应用程序,它是内存密集型的。 Because of that, I have added an HPA, which has 60% memory utilization.因此,我添加了一个 HPA,它的内存利用率为 60%。 We would like to have only this info in cloudwatch, so we can scale our servers accordingly.我们希望在 cloudwatch 中只有这些信息,因此我们可以相应地扩展我们的服务器。 I tried container insights, but it's an overkill.我尝试了容器洞察,但这是一种矫枉过正。
Is there any way to get Kubernetes HPA logs in cloudwatch as events?有没有办法将 Kubernetes HPA 日志作为事件获取到 cloudwatch 中?
HPA :卫生署:
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: resize-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1beta1
kind: Deployment
name: magento-prod-deployment
minReplicas: 2
maxReplicas: 5
metrics:
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: 60
Versions :版本:
kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.8", GitCommit:"9f2892aab98fe339f3bd70e3c470144299398ace", GitTreeState:"clean", BuildDate:"2020-08-26T20:32:49Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15+", GitVersion:"v1.15.11-eks-065dce", GitCommit:"065dcecfcd2a91bd68a17ee0b5e895088430bd05", GitTreeState:"clean", BuildDate:"2020-07-16T01:44:47Z", GoVersion:"go1.12.17", Compiler:"gc", Platform:"linux/amd64"}
EKS cluster is running on 1.15 EKS 集群运行于 1.15
I believe you can use k8s-cloudwatch-adapter
for your needs.我相信您可以使用k8s-cloudwatch-adapter
来满足您的需求。 Scaling Kubernetes deployments with Amazon CloudWatch metrics documentation provides the info on how k8s-cloudwatch-adapter
works, how you can install and use it. 使用 Amazon CloudWatch 指标扩展 Kubernetes 部署文档提供了有关k8s-cloudwatch-adapter
如何工作以及如何安装和使用它的信息。
Amazon CloudWatch Metrics Adapter for Kubernetes适用于 Kubernetes 的 Amazon CloudWatch 指标适配器
The k8s-cloudwatch-adapter is an implementation of the Kubernetes Custom Metrics API and External Metrics API with integration for CloudWatch metrics. k8s-cloudwatch-adapter 是 Kubernetes 自定义指标 API 和外部指标 API 的实现,并集成了 CloudWatch 指标。 It allows you to scale your Kubernetes deployment using the Horizontal Pod Autoscaler (HPA) with CloudWatch metrics.它允许您使用带有 CloudWatch 指标的 Horizontal Pod Autoscaler (HPA) 来扩展 Kubernetes 部署。
k8s-cloudwatch-adapter github k8s-cloudwatch-适配器github
Please also look into Kubernetes AWS Cloudwatch adapter not fetching custom metric value for EKS HPA autoscaling - already good example on how to enable AWS EKS autoscaling based on a custom Cloudwatch metric另请查看Kubernetes AWS Cloudwatch 适配器未获取 EKS HPA 自动缩放的自定义指标值- 关于如何基于自定义 Cloudwatch 指标启用 AWS EKS 自动缩放的好示例
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.