{"id":13646834,"url":"https://github.com/amazon-archives/k8s-cloudwatch-adapter","last_synced_at":"2025-04-21T21:31:29.688Z","repository":{"id":46804171,"uuid":"177212912","full_name":"amazon-archives/k8s-cloudwatch-adapter","owner":"amazon-archives","description":"An implementation of Kubernetes Custom Metrics API for Amazon CloudWatch","archived":true,"fork":false,"pushed_at":"2021-09-24T16:17:36.000Z","size":8628,"stargazers_count":158,"open_issues_count":44,"forks_count":98,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-11-09T20:37:49.101Z","etag":null,"topics":["aws-cloudwatch","cloudwatch-metrics","eks","kubernetes"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amazon-archives.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-22T21:44:34.000Z","updated_at":"2024-10-31T12:38:09.000Z","dependencies_parsed_at":"2022-09-13T03:12:19.214Z","dependency_job_id":null,"html_url":"https://github.com/amazon-archives/k8s-cloudwatch-adapter","commit_stats":null,"previous_names":["awslabs/k8s-cloudwatch-adapter"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-archives%2Fk8s-cloudwatch-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-archives%2Fk8s-cloudwatch-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-archives%2Fk8s-cloudwatch-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amazon-archives%2Fk8s-cloudwatch-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amazon-archives","download_url":"https://codeload.github.com/amazon-archives/k8s-cloudwatch-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250136714,"owners_count":21380880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-cloudwatch","cloudwatch-metrics","eks","kubernetes"],"created_at":"2024-08-02T01:03:09.322Z","updated_at":"2025-04-21T21:31:29.415Z","avatar_url":"https://github.com/amazon-archives.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/awslabs/k8s-cloudwatch-adapter.svg?branch=master)](https://travis-ci.org/awslabs/k8s-cloudwatch-adapter)\n[![GitHub\nrelease](https://img.shields.io/github/release/awslabs/k8s-cloudwatch-adapter/all.svg)](https://github.com/awslabs/k8s-cloudwatch-adapter/releases)\n[![docker image\nsize](https://shields.beevelop.com/docker/image/image-size/chankh/k8s-cloudwatch-adapter/latest.svg)](https://hub.docker.com/r/chankh/k8s-cloudwatch-adapter)\n[![image\nlayers](https://shields.beevelop.com/docker/image/layers/chankh/k8s-cloudwatch-adapter/latest.svg)](https://hub.docker.com/r/chankh/k8s-cloudwatch-adapter)\n[![image\npulls](https://shields.beevelop.com/docker/pulls/chankh/k8s-cloudwatch-adapter.svg)](https://hub.docker.com/r/chankh/k8s-cloudwatch-adapter)\n\n\u003e Attention! This project has been archived and is no longer being worked on. If you are looking for a metrics server that can consume metrics from CloudWatch, please consider using the [KEDA](https://keda.sh) project instead. KEDA is a Kubernetes-based Event Driven Autoscaler. With KEDA, you can drive the scaling of any container in Kubernetes based on the number of events needing to be processed. For an overview of KEDA, see [An overview of Kubernetes Event-Driven Autoscaling](https://youtu.be/H5eZEq_wqSE).\n\n# Kubernetes Custom Metrics Adapter for Kubernetes\n\n\nAn implementation of the Kubernetes [Custom Metrics API and External Metrics\nAPI](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis)\nfor AWS CloudWatch metrics.\n\nThis adapter allows you to scale your Kubernetes deployment using the [Horizontal Pod\nAutoscaler](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) (HPA) with\nmetrics from AWS CloudWatch.\n\n## Prerequisites\nThis adapter requires the following permissions to access metric data from Amazon CloudWatch.\n- cloudwatch:GetMetricData\n\nYou can create an IAM policy using this template, and attach it to the [Service Account Role](https://docs.aws.amazon.com/eks/latest/userguide/specify-service-account-role.html) if you are using\n[IAM Roles for Service Accounts](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html).\n\n```json\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"cloudwatch:GetMetricData\"\n            ],\n            \"Resource\": \"*\"\n        }\n    ]\n}\n```\n\n## Deploy\nRequires a Kubernetes cluster with Metric Server deployed, Amazon EKS cluster is fine too.\n\nNow deploy the adapter to your Kubernetes cluster:\n\n```bash\n$ kubectl apply -f https://raw.githubusercontent.com/awslabs/k8s-cloudwatch-adapter/master/deploy/adapter.yaml\nnamespace/custom-metrics created\nclusterrolebinding.rbac.authorization.k8s.io/k8s-cloudwatch-adapter:system:auth-delegator created\nrolebinding.rbac.authorization.k8s.io/k8s-cloudwatch-adapter-auth-reader created\ndeployment.apps/k8s-cloudwatch-adapter created\nclusterrolebinding.rbac.authorization.k8s.io/k8s-cloudwatch-adapter-resource-reader created\nserviceaccount/k8s-cloudwatch-adapter created\nservice/k8s-cloudwatch-adapter created\napiservice.apiregistration.k8s.io/v1beta1.external.metrics.k8s.io created\nclusterrole.rbac.authorization.k8s.io/k8s-cloudwatch-adapter:external-metrics-reader created\nclusterrole.rbac.authorization.k8s.io/k8s-cloudwatch-adapter-resource-reader created\nclusterrolebinding.rbac.authorization.k8s.io/k8s-cloudwatch-adapter:external-metrics-reader created\ncustomresourcedefinition.apiextensions.k8s.io/externalmetrics.metrics.aws created\nclusterrole.rbac.authorization.k8s.io/k8s-cloudwatch-adapter:crd-metrics-reader created\nclusterrolebinding.rbac.authorization.k8s.io/k8s-cloudwatch-adapter:crd-metrics-reader created\n```\n\nThis creates a new namespace `custom-metrics` and deploys the necessary ClusterRole, Service Account,\nRole Binding, along with the deployment of the adapter.\n\nAlternatively the crd and adapter can be deployed using the Helm chart in the `/charts` directory:\n\n```bash\n$ helm install k8s-cloudwatch-adapter-crd ./charts/k8s-cloudwatch-adapter-crd\nNAME: k8s-cloudwatch-adapter-crd\nLAST DEPLOYED: Thu Sep 17 11:36:53 2020\nNAMESPACE: default\nSTATUS: deployed\nREVISION: 1\nTEST SUITE: None\n$ helm install k8s-cloudwatch-adapter ./charts/k8s-cloudwatch-adapter \\\n\u003e   --namespace custom-metrics \\\n\u003e   --create-namespace\nNAME: k8s-cloudwatch-adapter\nLAST DEPLOYED: Fri Aug 14 13:20:17 2020\nNAMESPACE: custom-metrics\nSTATUS: deployed\nREVISION: 1\nTEST SUITE: None\n```\n\n### Verifying the deployment\nNext you can query the APIs to see if the adapter is deployed correctly by running:\n\n```bash\n$ kubectl get --raw \"/apis/external.metrics.k8s.io/v1beta1\" | jq .\n{\n  \"kind\": \"APIResourceList\",\n  \"apiVersion\": \"v1\",\n  \"groupVersion\": \"external.metrics.k8s.io/v1beta1\",\n  \"resources\": [\n  ]\n}\n```\n\n## Deploying the sample application\nThere is a sample SQS application provided in this repository for you to test how the adapter works.\nRefer to this [guide](samples/sqs/README.md).\n\n## More docs\n- [Configuring cross account metric example](docs/cross-account.md)\n- [ExternalMetric CRD schema](docs/schema.md)\n\n## License\n\nThis library is licensed under the Apache 2.0 License.\n\n## Issues\nReport any issues in the [Github Issues](https://github.com/awslabs/k8s-cloudwatch-adapter/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famazon-archives%2Fk8s-cloudwatch-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famazon-archives%2Fk8s-cloudwatch-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famazon-archives%2Fk8s-cloudwatch-adapter/lists"}