Skip to content

Cluster Inventory

Overview

A Kelvin edge service running on each Cluster reports the Kubernetes resources that are running on it to the Kelvin Platform. This includes your Workloads, the Kelvin services, and any other Kubernetes resource such as Pods, Deployments, ConfigMaps and Namespaces.

The Cluster Inventory is a mirror of those resources. You can query it from the Kelvin Platform without connecting to the Cluster, to see what is running on the Cluster and the status of each resource.

Note

The Cluster Inventory is mostly intended for debugging. There is currently no page for it in the Kelvin UI, so it is available with Kelvin API only.

The list shows the resources last reported by the Cluster. If the Cluster is offline, you will see the last state it reported before it went offline.

List Cluster Inventory

Returns the list of resources last reported by a Cluster. The list can be filtered and sorted on the server before it is returned.

Note

The kelvin.permission.cluster.read permission is required.

Parameters

Parameter Description
cluster_name Required. The name of the Cluster to list the resources of.
search Filter the list on the resource name. It is case insensitive and finds partial matches.
namespace Filter the list on the resource namespace. The full name is needed. You can set more than one and they are treated as OR.
kind Filter the list on the resource kind, for example Pod, Deployment, ConfigMap or Namespace. The full name is needed. You can set more than one and they are treated as OR.
ready Filter the list on whether the resource is ready (true or false). Resources of a kind that has no readiness notion are not returned when this filter is set.
sort_by Sort the list by one or more of namespace, kind, name, ready, status, restarts and updated. The default is namespace, kind and name.
direction The sorting order of sort_by, asc (default) or desc.
pagination_type cursor (default), limits or stream. stream returns all the results.
page_size The number of resources in each page, from 1 to 10000. The default is 20.

Response

Each resource in the list has the following fields;

Field Description
kind The Kubernetes kind of the resource.
name The name of the resource, unique within its namespace and kind.
namespace The Kubernetes namespace containing the resource.
ready Whether the resource is ready. It is null when the kind has no readiness notion.
restarts The number of container restarts reported for the resource.
status The status phase or reason reported by Kubernetes for the resource.
summary A summary of the details of the resource. The content depends on the kind.
updated The UTC time when the resource summary last changed.

This can not be viewed in the Kelvin UI.

API cURL Example
1
2
3
4
curl -X "GET" \
  "https://<url.kelvin.ai>/api/v4/orchestration/clusters/<Your Cluster Name>/inventory/list?kind=Pod&namespace=kelvin&pagination_type=cursor&page_size=20" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json"

The response will look like this;

API cURL Example Response
{
  "pagination": {
    "next_page": null,
    "previous_page": null
  },
  "data": [
    {
      "kind": "Pod",
      "name": "edge-sync-0",
      "namespace": "kelvin",
      "ready": true,
      "restarts": 0,
      "status": "Running",
      "summary": { ... },
      "updated": "2024-12-18T18:22:18.582724Z"
    },

    ...

  ]
}
API Client (Python) Example
from kelvin.api.client import Client

# Login
client = Client(url="https://<url.kelvin.ai>", username="<your_username>")
client.login(password="<your_password>")

# List the Pods in the kelvin namespace of a Cluster
response = client.orchestration.list_orchestration_clusters_inventory(
    cluster_name="<Your Cluster Name>",
    kind=["Pod"],
    namespace=["kelvin"],
)

for resource in response:
    print(f"{resource.namespace} {resource.kind} {resource.name} {resource.status} ready={resource.ready} restarts={resource.restarts}")

You will receive an output like this;

API Client (Python) Example Response
kelvin Pod edge-sync-0 Running ready=True restarts=0
...