This action requires a Kubernetes service account token.

GetKubernetesResource — retrieves a resource from a Kubernetes cluster.

Request example

group: managed-services.deckhouse.io
version: v1alpha1
resource_type: postgres
resource_name: example-postgres
namespace: default

Request specification

NameRequiredDescriptionPossible values
groupYesAPI group of the resource. Specifies the API group to which the requested object belongsDetermining the required Group and Version
versionYesAPI version of the resourceDetermining the required Group and Version
resource_typeYesType of resource to retrieve-
resource_nameYesName of the resource to retrieve-
namespaceYesNamespace containing the resource-

Response

On success, the action returns the resource object in the resource field. If the resource is not found, the action fails with an error.

NameDescription
resourceResource object in Kubernetes format

Determining the required Group and Version

Each resource type has its own API group (Group) and version (Version). A complete list of API resources, groups, and versions is available in the Kubernetes documentation.

If you do not know which API groups and versions are required, you can look up the current values. There are several ways to determine them:

Using the d8 k utility

The d8 k explain command shows the apiVersion for a resource.

Example:

d8 k explain deployment

Example output:

GROUP:      apps
KIND:       Deployment
VERSION:    v1

DESCRIPTION:
    Deployment enables declarative updates for Pods and ReplicaSets.
    
FIELDS:
...

Using the documentation

  1. Find the resource you need (for example, Deployment).

  2. Find the API group and version in the header. For example, for Deployment:

    apiVersion: apps/v1

    Here:

    • API Group is apps;
    • Version is v1.