metrics-server-armada-app/sample-app/readme.md
Erickson Silva de Oliveira f191346f95 Upgrade metrics-server to version 3.12.0/0.7.0
Upgrade metrics-server helm charts version from 3.11.0 to 3.12.0
and metrics-server image version from 0.6.4 to 0.7.0.
The new version supports k8s 1.24 - 1.29.

Furthermore, the name of the example application, which was in
the singular, and the readme, which was inconsistent, were corrected.

Test Plan:
    PASS: Build package
    PASS: App upload/apply/update/remove/delete
    PASS: Check application version
    PASS: Run sample application

Story: 2010681
Task: 49567

Change-Id: Ie592c03147b3cf40e9eeb631c18725d25460becf
Signed-off-by: Erickson Silva de Oliveira <Erickson.SilvadeOliveira@windriver.com>
2024-02-16 14:53:32 -03:00

41 lines
1.9 KiB
Markdown

# Sample App
Containerized application that retrieves metrics server data
## How does it work ?
The sample app is a Nodejs app that requests the metrics every second and prints that in the console. The deployment creates a service account, roles and role binding to allows this application communicate with the api, this token is stored by default on `/var/run/secrets/kubernetes.io/serviceaccount/token`, the application is reading that token and doing the requests on the endpoint `/apis/metrics.k8s.io/v1beta1/pods` that returns all pod metrics and log it on console.
## Structure
```
sample-app
├── debian
│ └── sample-app.stable_docker_image
├── docker
│ ├── Dockerfile.debian
│ └── src
│ ├── package.json
│ └── sample-application.js
└── readme.md
```
Important files
- src - Contains Nodejs application
- Dockerfile - Application Dockerfile
## Run application
> Deploy tha sample app using `system helm-override-update --reuse-values --set atribute=value <app name> <chart name> <namespace>` follow the steps below:
- Run `system helm-override-update --reuse-values --set sampleApp.create=true metrics-server metrics-server metrics-server`
- Run `system application-apply metrics-server` to apply the override
- Run `kubectl get pods -n metrics-server` to get the name of the pod.
- Run `kubectl logs -n metrics-server <pod-name> --tail 1 -f` to see the logs and check if the sample application is requesting successfully the metrics server api
## Endpoints
All of the following endpoints are GET endpoints and they are under the base path `/apis/metrics.k8s.io/v1beta1`:
- `/nodes` - all node metrics
- `/nodes/{node}` - metrics for a specified node
- `/namespaces/{namespace}/pods` - all pod metrics within namespace with support for all-namespaces
- `/namespaces/{namespace}/pods/{pod}` - metrics for a specified pod
- `/pods` - all pod metrics of all namespaces