Dagweave catalog

Read Kubernetes resources as JSON

kubectl-get-jsonv1.0.0updated 2026-10-181 version

Read one resource, or a list of them, from the cluster and pass the JSON to later steps as the json output.

Install v1.0.0

Installs the template into your Argo namespace. The URL is pinned to this version.

kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/kubectl-get-json/1.0.0/template.yaml

Or with the Argo CLI:

argo template create -n argo https://catalog.dagweave.com/api/v1/items/kubectl-get-json/1.0.0/template.yaml

Facts

Category
Kubernetes
Tags
kubectl kubernetes
Entrypoint
get
Template SHA-256
e9db313bcc555666a4d2f70009a7c1852470bf60fda04537e60e8f82b18c8e07
Source
kubectl-get-json at catalog commit 67458f7
API
item document, latest template.yaml

Images and provenance

Every image is pinned by digest, so a rebuilt tag can never change what this version runs.

RepositoryTagDigest
cgr.dev/chainguard/kubectllatest-devsha256:98f9c337808ecf5d5e80b79af4345762a3d8c803ebf8c857d2dddabf885107ba

Parameters

NameDescriptionDefault
resource required What to read: kind/name for one object, or just a kind for a list.
Example deployment/checkout-api
none
namespace Namespace the resource lives in.
Example default
default
selector Label selector that narrows a list. Leave blank to read everything of that kind.
Example app=checkout-api
empty

WorkflowTemplate

Download template.yaml

apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
  name: kubectl-get-json
  labels:
    dagweave.io/catalog-item: kubectl-get-json
  annotations:
    dagweave.io/catalog-version: "1.0.0"
    dagweave.io/catalog-category: "Kubernetes"
spec:
  entrypoint: get
  templates:
    - name: get
      metadata:
        annotations:
          dagweave.io/local-support: unsupported
          dagweave.io/local-support-reason: >-
            This step runs kubectl with whatever identity the pod is given. On Dagweave
            Local that is the default service account of the hidden cluster's argo
            namespace, which Argo's quick-start install grants create, get and patch on pods
            and create and get on workflows, and nothing anywhere else. Reading a Deployment
            or a Node is outside what that account may do, so the step fails on a 403 rather
            than touching anything. The cluster you meant is one this run cannot reach.
      inputs:
        parameters:
          - name: resource
          - name: namespace
            default: "default"
          - name: selector
            default: ""
      outputs:
        parameters:
          # The resource as JSON.
          - name: json
            valueFrom:
              path: /tmp/output.json
      retryStrategy:
        limit: "2"
        retryPolicy: OnFailure
        backoff:
          duration: 10s
          factor: "2"
          maxDuration: 2m
      container:
        # cgr.dev/chainguard/kubectl:latest-dev
        image: cgr.dev/chainguard/kubectl@sha256:98f9c337808ecf5d5e80b79af4345762a3d8c803ebf8c857d2dddabf885107ba
        command: [sh, -c]
        args:
          - |
            set -eu
            if [ -n "${SELECTOR}" ]; then
              kubectl get "${RESOURCE}" -n "${NAMESPACE}" -l "${SELECTOR}" -o json > /tmp/output.json
            else
              kubectl get "${RESOURCE}" -n "${NAMESPACE}" -o json > /tmp/output.json
            fi
            cat /tmp/output.json
        env:
          - name: RESOURCE
            value: "{{inputs.parameters.resource}}"
          - name: NAMESPACE
            value: "{{inputs.parameters.namespace}}"
          - name: SELECTOR
            value: "{{inputs.parameters.selector}}"
        resources:
          requests:
            cpu: 50m
            memory: 64Mi
          limits:
            memory: 256Mi

Version history

Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.

  1. 1.0.0 latest 2026-10-18

    Initial release.

    kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/kubectl-get-json/1.0.0/template.yaml
    argo template create -n argo https://catalog.dagweave.com/api/v1/items/kubectl-get-json/1.0.0/template.yaml

    version document, template.yaml

Run it once

After installing, from the command line.

argo submit -n argo --from workflowtemplate/kubectl-get-json \
  -p resource=deployment/checkout-api

Workflow that references it

A Workflow with the required parameters filled from the examples.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: kubectl-get-json-
spec:
  workflowTemplateRef:
    name: kubectl-get-json
  arguments:
    parameters:
      - name: resource
        value: "deployment/checkout-api"

As a step of a larger workflow

steps:
  - - name: kubectl-get-json
      templateRef:
        name: kubectl-get-json
        template: get