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: defaultRequest specification
| Name | Required | Description | Possible values |
|---|---|---|---|
| group | Yes | API group of the resource. Specifies the API group to which the requested object belongs | Determining the required Group and Version |
| version | Yes | API version of the resource | Determining the required Group and Version |
| resource_type | Yes | Type of resource to retrieve | - |
| resource_name | Yes | Name of the resource to retrieve | - |
| namespace | Yes | Namespace 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.
| Name | Description |
|---|---|
resource | Resource 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 deploymentExample output:
GROUP: apps
KIND: Deployment
VERSION: v1
DESCRIPTION:
Deployment enables declarative updates for Pods and ReplicaSets.
FIELDS:
...Using the documentation
Find the resource you need (for example, Deployment).
Find the API group and version in the header. For example, for Deployment:
apiVersion: apps/v1Here:
API Groupisapps;Versionisv1.