After deploying the RealTheory collector to a Kubernetes cluster (See Installing RealTheory in a Cluster), the cluster and its associated objects, including any Recommendations, become available in the RealTheory API within minutes.
Get Recommendations
To get the list of available recommendations for a given cluster, call the method below on the K8sRecommendations endpoint.
GET <endpoint>/theory/api/v1/k8srecommendations/recommendations/search/query/{query}?index={index}&count={count}&order={order}&direction={direction}
where
{endpoint}- is the URL of the RealTheory SaaS portal for your account.{query}- is a query used to limit the results to recommendations within a given cluster.{index}- is the starting index of the recommendations to include in the list. This parameter is optional and defaults to 0 if not specified.{count}- is the maximum number of recommendations to return, up to a limit of 500. This parameter is optional and defaults to 100 if not specified.{order}- is a string containing the name of the attribute to sort on. This parameter is optional.{direction}- is a number that controls the direction of the sort. A value equal to or greater than 0 indicates ascending order; a value less than 0 indicates descending order. This parameter is optional and defaults to 0 if not specified.
Notes:
- All calls to RealTheory APIs must be authenticated and authorized. See Authentication for more details.
- To retrieve all recommendations, increment the
{index}by the{count}on each subsequent call until a response returns fewer recommendations than the{count}requested. See Paging for more details on how to page through all results.
Example
GET theory/api/v1/k8srecommendations/recommendations/search/query/metadata.clusterName=realtheory-cluster-01?index=0&count=100&order=score&direction=1
which returns a list of the first 100 recommendations associated with cluster realtheory-cluster-01, sorted by score in ascending order.
Notes:
- As cluster names are not guaranteed to be unique across all environments, it is strongly recommended to use
metadata.clusterIdfield instead of themetadata.clusterNamein order to uniquely identify a cluster in the above query. - The query should be URL encoded; otherwise, the request might be rejected.
Output
Returns an array of Recommendation objects:
[
{
"id": "3e67fe00-fdbf-e2cd-e9aa-2cc1ccdba978",
"key": "PodLivenessProbeGovernanceAdvisory::9e57e04b2855454196285ad879daef08::queue",
"metadata": {
"objectType": "Pod",
"objectId": "9e57e04b-2855-4541-9628-5ad879daef08",
"objectName": "queue-767b8d9c88-rwvjx",
"clusterId": "f99e055f-b35d-208b-63b1-f4222b80151a",
"clusterName": "realtheory-cluster-01",
"nodeId": "00000000-0000-0000-0000-000000000000",
"nodeName": "",
"customResourceDefinitionId": "00000000-0000-0000-0000-000000000000",
"customResourceDefinitionName": "",
"namespaceId": "0b3c50fe-5116-44bd-b229-543251be4e74",
"namespaceName": "web-app",
"deploymentId": "a6ffe9d7-8bda-43a9-bc65-4f7dfdbc7ebf",
"deploymentName": "queue",
"podId": "9e57e04b-2855-4541-9628-5ad879daef08",
"podName": "queue-767b8d9c88-rwvjx",
...
},
"title": "Configure a liveness probe",
"description": "Edit the pod specification and configure a liveness probe.",
"details": "The container 'queue' within pod 'queue-767b8d9c88-rwvjx' does not have a liveness probe configured.",
"action": "Edit the pod specification for pod 'queue-767b8d9c88-rwvjx' and configure a liveness probe for container 'queue'",
"benefits": "Improves application reliability and availability.",
"state": "New",
"category": "Governance",
"classification": "None",
"impact": "Low",
"effort": "Low",
"confidence": "High",
"score": 50,
"source": "Pod Liveness Probe Check (governance check)",
"sourceId": "e32acdd3-53b3-4c5c-b8f9-f4a05c7cb51e",
"alert": "The pod includes containers without liveness probes.",
"alertId": "52d70996-b316-d9b7-da43-e8258bab853a",
"advisory": "Pod Liveness Probe Governance Advisory",
"advisoryId": "4fce3bd4-2228-4144-b88e-7c884e2ec226",
"comments": "",
"assignedTo": "",
"url": "https://resources.realtheory.io/docs/how-to-address-container-liveness-probe-issues",
"urlTitle": "How To Address Container Liveness Probe Issues",
"properties": {},
"created": "2024-06-30T19:44:34.0367823Z",
"updated": "2024-09-04T18:56:37.0746637Z",
"postponedUntil": null,
"expires": "2024-09-04T19:01:35.6003209Z"
},
...
]
Note: Content has been omitted from the JSON response above for brevity.