Skip to content

Commit

Permalink
[ENG-2969] Turbonomic Integration & Savings APIs (#1157)
Browse files Browse the repository at this point in the history
  • Loading branch information
biancaburtoiu authored Dec 10, 2024
1 parent 8331ab7 commit 36ff6bd
Show file tree
Hide file tree
Showing 10 changed files with 280 additions and 1 deletion.
3 changes: 3 additions & 0 deletions SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
* [Spot Commander](using-kubecost/navigating-the-kubecost-ui/savings/spot-commander.md)
* [Persistent Volume Right-Sizing Recommendations](using-kubecost/navigating-the-kubecost-ui/savings/pv-right-sizing-rec.md)
* [GPU Optimization](using-kubecost/navigating-the-kubecost-ui/savings/gpu-optimization.md)
* [Turbonomic Actions](using-kubecost/navigating-the-kubecost-ui/savings/turbonomic-actions.md)
* [Budgets](using-kubecost/navigating-the-kubecost-ui/budgets.md)
* [Audits](using-kubecost/navigating-the-kubecost-ui/audits.md)
* [Anomaly Detection](using-kubecost/navigating-the-kubecost-ui/anomaly-detection.md)
Expand Down Expand Up @@ -162,6 +163,7 @@
* [Container Request Right Sizing Recommendation API (V2)](apis/savings-apis/api-request-right-sizing-v2.md)
* [Container Request Recommendation Apply/Plan APIs](apis/savings-apis/api-request-recommendation-apply.md)
* [Abandoned Workloads API](apis/savings-apis/api-abandoned-workloads.md)
* [Turbonomic Actions APIs](apis/savings-apis/api-turbonomic-actions.md)
* [Filter Parameters (v2)](apis/filters-api.md)

## Architecture
Expand All @@ -187,6 +189,7 @@
* [Importing Kubecost Data into Microsoft Power BI](integrations/import-kubecost-data-into-microsoft-power-bi.md)
* [Integrating Kubecost with Datadog](integrations/integrating-kubecost-with-datadog.md)
* [Using Custom Webhook to Create a Kubecost Stage in Spinnaker](integrations/spinnaker-custom-webhook.md)
* [Kubecost Turbonomic Integration](integrations/turbonomic-integration.md)

## Troubleshooting

Expand Down
174 changes: 174 additions & 0 deletions apis/savings-apis/api-turbonomic-actions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
# Turbonomic Actions

{% swagger method="get" path="turbonomic/resizeWorkloadControllers" baseUrl="http://<kubecost-address>/model/savings/" summary="Turbonomic Actions: Resize Workload Controllers" %}
{% swagger-description %}
The Resize Workload Controllers API returns workloads for which request resizing has been recommended by Turbonomic. The list of results returned should align with those in the Turbonomic Actions Center.
{% endswagger-description %}

{% swagger-parameter in="path" name="filter" type="string" required="false" %}
Filter your results by cluster, namespace and/or controller.
{% endswagger-parameter %}

{% swagger-response status="200: OK" description="" %}
```json
{
"code": 200,
"data": {
"numResults": 1,
"totalSavings": 2.00,
"actions": [
{
"action": {
"cluster": "standard-cluster-1",
"namespace": "kubecost",
"controller": "kubecost-cost-analyzer",
"replicaCount": 1,
"compoundActions": {
"cost-model": [
{
"target": "VCPURequest",
"unit": "mCores",
"oldValue": 200,
"newValue": 100
}
]
},
"available": true,
"targetId": "11111111111111"
},
"currentMonthlyRate": 4.00,
"predictedMonthlyRate": 2.00,
"predictedSavings": 2.00
}
]
}
}
```
{% endswagger-response %}
{% endswagger %}

{% swagger method="get" path="turbonomic/suspendContainerPods" baseUrl="http://<kubecost-address>/model/savings/" summary="Turbonomic Actions: Suspend Container Pods" %}
{% swagger-description %}
The Suspend Container Pods API returns pods that Turbonomic recommends for suspension. The list of results returned should align with those in the Turbonomic Actions Center.
{% endswagger-description %}

{% swagger-parameter in="path" name="filter" type="string" required="false" %}
Filter your results by cluster, namespace, controller and/or pod.
{% endswagger-parameter %}

{% swagger-response status="200: OK" description="" %}
```json
{
"code": 200,
"data": {
"numResults": 1,
"totalSavings": 12.37,
"actions": [
{
"action": {
"cluster": "standard-cluster-1",
"namespace": "infra-cost",
"controller": "infra-cost-agent",
"pod": "infra-cost-agent-xdj34",
"available": true,
"targetId": "11111111111111"
},
"currentMonthlyRate": 12.37,
"predictedMonthlyRate": 0,
"predictedSavings": 12.37
}
]
}
}
```
{% endswagger-response %}
{% endswagger %}

{% swagger method="get" path="turbonomic/suspendVirtualMachines" baseUrl="http://<kubecost-address>/model/savings/" summary="Turbonomic Actions: Suspend Virtual Machines" %}
{% swagger-description %}
The Suspend Container Pods API returns virtual machines that Turbonomic recommends for suspension. The list of results returned should align with those in the Turbonomic Actions Center.
{% endswagger-description %}

{% swagger-parameter in="path" name="filter" type="string" required="false" %}
Filter your results by cluster.
{% endswagger-parameter %}

{% swagger-response status="200: OK" description="" %}
```json
{
"code": 200,
"data": {
"numResults": 1,
"totalSavings": 9.03,
"actions": [
{
"action": {
"cluster": "standard-cluster-1",
"node": "gke-standard-cluster-1-spotpool-b4a02c44-1001",
"available": true,
"targetId": "11111111111111"
},
"currentMonthlyRate": 9.03,
"predictedMonthlyRate": 0,
"predictedSavings": 9.03
}
]
}
}
```
{% endswagger-response %}
{% endswagger %}

{% swagger method="get" path="turbonomic/moveContainerPods" baseUrl="http://<kubecost-address>/model/savings/" summary="Turbonomic Actions: Move Container Pods" %}
{% swagger-description %}
The Move Container Pods API returns pods that Turbonomic recommends to be moved from one node to another. The list of results returned should align with those in the Turbonomic Actions Center.
{% endswagger-description %}

{% swagger-parameter in="path" name="filter" type="string" required="false" %}
Filter your results by cluster, namespace, controller and/or pod.
{% endswagger-parameter %}

{% swagger-response status="200: OK" description="" %}
```json
{
"code": 200,
"data": {
"numResults": 2,
"totalSavings": 30.0,
"actions": [
{
"action": {
"cluster": "standard-cluster-1",
"namespace": "turbo-server",
"controller": "db",
"pod": "db-ffbdfb97b-aroxf",
"originNode": "gke-standard-cluster-1-pool-1-b4a02c44-1001",
"destinationNode": "gke-standard-cluster-1-pool-2-91dc432d-1002",
"available": true,
"targetId": "11111111111111"
},
"currentMonthlyRate": 27.90,
"predictedMonthlyRate": 0,
"predictedSavings": 27.90
},
{
"action": {
"cluster": "standard-cluster-1",
"namespace": "infra-kubecost",
"controller": "infra-kubecost-cost-analyzer",
"pod": "infra-kubecost-cost-analyzer-566b488b69-1001a",
"originNode": "gke-standard-cluster-1-pool-2-91dc432d-1002",
"destinationNode": "gke-standard-cluster-1-pool-3-57364626-1003",
"available": true,
"targetId": "11111111111112"
},
"currentMonthlyRate": 2.10,
"predictedMonthlyRate": 0,
"predictedSavings": 2.10
}
]
}
}
```
{% endswagger-response %}
{% endswagger %}
Binary file added images/savings-turbo-actions-mcp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/savings-turbo-actions-rwc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/savings-turbo-actions-scp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/savings-turbo-actions-svm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/savings-turbo-actions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions integrations/turbonomic-integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Kubecost Turbonomic Integration

{% hint style="info" %}
This integration is currently in beta. Please read the documentation carefully.
{% endhint %}

The Turbonomic Integration feature enables users to obtain supplemental cost information on actions recommended by Turbonomic. This integration is required to display the [Turbonomic Actions Savings Cards](../using-kubecost/navigating-the-kubecost-ui/savings/turbonomic-actions.md).

## Usage

Prerequisites:

- A running Turbonomic client

Kubecost will require network access to your Turbonomic installation via an OAuth 2.0 Client. We require the following settings on the OAuth client:
- Role: `ADVISOR`
- ClientAuthenticationMethods: `client_secret_post`

Please see the [IBM Turbonomic documentation](https://www.ibm.com/docs/en/tarm/8.14.3?topic=cookbook-authenticating-oauth-20-clients-api#cookbook_administration_oauth_authentication__title__4) on more instructions on how to create an OAuth 2.0 client.

### Step 1: Configure Helm values

The below YAML is an example of how to configure the Turbonomic integration in your Helm values file.

```yaml
global:
integrations:
turbonomic:
enabled: true
clientId: "" # REQUIRED. OAuth 2.0 client ID
clientSecret: "" # REQUIRED. OAuth 2.0 client secret
role: "ADVISOR" # REQUIRED. OAuth 2.0 client role
host: "" # REQUIRED. URL to the Turbonomic API (e.g. "https://turbonomic.example.com")
insecureClient: false # Whether to verify certificate or not. Default false.
```
### Step 2: Apply and validate your changes
If deploying changes via Helm, you will be able to run a command similar to:
```sh
helm upgrade -i kubecost cost-analyzer \
--repo https://kubecost.github.io/cost-analyzer/ \
--namespace kubecost \
-f values.yaml
```

Once you've applied your changes, validate that the integration is successful by checking the Aggregator pod logs. You should see logs similar to the following:

```sh
kubectl logs statefulset/kubecost-aggregator -n kubecost | grep -i "Turbonomic"
```

```txt
DBG Turbonomic: Ingestor: completed run with 32 turbonomic actions ingested
```
8 changes: 7 additions & 1 deletion using-kubecost/navigating-the-kubecost-ui/savings/savings.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ The monthly savings values on this page are precomputed every hour for performan
* [Manage underutilized nodes](underutilized-nodes.md)
* [Right-size your persistent volumes](pv-right-sizing-rec.md)

### Cloud insights:
### Cloud insights

* Reserve instances
* [Manage orphaned resources](orphaned-resources.md)
* [Spot Instances](spot-checklist.md)

### Turbonomic Actions insights
* [Resize Workload Controllers](turbonomic-actions.md)
* [Suspend Container Pods](turbonomic-actions.md)
* [Suspend Virtual Machines](turbonomic-actions.md)
* [Move Container Pods](turbonomic-actions.md)

## Archiving Savings insights

You can archive individual Savings insights if you feel they are not helpful, or you cannot perform those functions within your organization or team. Archived Savings insights will not add to your estimated monthly savings available.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Turbonomic Actions

{% hint style="warning" %}
This feature is in beta. Please read the documentation carefully.
{% endhint %}

The [IBM Turbonomic Action Center](https://www.ibm.com/docs/en/tarm/8.14.3?topic=reference-turbonomic-actions) offers multiple types of actions destined to improve the overall performance of your cluster(s). The integration between Kubecost and Turbonomic allows you to view the estimated savings incurred by executing these actions.

## Prerequisites
To be able to see the savings cards, you must first enable the [Turbonomic Integration](../../../integrations/turbonomic-integration.md). This is required for Kubecost to be able to pull action data from your Turbonomic client.

## Actions
![Savings cards: Turbonomic Actions](../../../images/savings-turbo-actions.png)

### Resize Workload Controllers
![Resize Workload Controllers](../../../images/savings-turbo-actions-rwc.png)

The Resize Workload Controllers page shows workloads which would benefit from changes to their resource requests, as recommended by Turbonomic.
The Current and Predicted cost columns are calculated using the [Spec Cost Prediction API](../../../apis/governance-apis/spec-cost-prediction-api.md): the Current column is calculated by inferring the CPU and/or memory requests on all Containers in the workload, while the Predicted column is calculated by using the new request values recommended by Turbonomic for each container. Please note that at the moment, this functionality is only available for Deployments and StatefulSets.

### Suspend Container Pods
![Suspend Container Pods](../../../images/savings-turbo-actions-scp.png)

The Suspend Container Pods page shows pods that Turbonomic recommends to be suspended.
The Current cost column represents the monthly rate for the Pod in question, queried over a period of `7d offset 48h` to account for reconciliation.
The Predicted cost column is zero for suspension actions.

### Suspend Virtual Machines
![Suspend Virtual Machines](../../../images/savings-turbo-actions-svm.png)

The Suspend Virtual Machines page shows virtual machines (nodes) that Turbonomic recommends to be suspended.
The Current cost column represents the monthly rate for the node in question, queried over a period of `7d offset 48h` to account for reconciliation.
The Predicted cost column is zero for suspension actions.

### Move Container Pods
![Move Container Pods](../../../images/savings-turbo-actions-mcp.png)

The Move Container Pods page shows pods that Turbonomic recommends to be moved from one node to another.
The Current cost column represents the monthly rate for the destination node, queried over a period of `7d offset 48h` to account for reconciliation.
The Efficiency column contains a hyperlink to the Efficiency page for the destination node, highlighting the infrastructure idle corresponding to it.

0 comments on commit 36ff6bd

Please sign in to comment.