GETTING STARTED WITH KUBERNETES IN SWAMP
In this tutorial, we will install the Swamp Kubernetes extension and use a pod behavior to read a cluster. First we list the kubeconfig contexts the behavior can see. Then we fetch every pod in the default namespace and store each one as Swamp data.
What we will build
We are going to pull the @swamp/kubernetes extension into a repository. Then we will use a pod behavior named dev-pods, which targets the default namespace through a kubeconfig context called kind-dev, to run its first two methods against the cluster.
Prerequisites
- Swamp installed (see Install Swamp) and a terminal open in a Swamp repository
- A kubeconfig with a context named kind-dev that points at a running cluster
Pull the extension
First, we pull the extension that provides the Kubernetes behavior types and workflows:
swamp extension pull @swamp/kubernetesYou will see output like:
INF extension·pull: Pulling "@swamp/kubernetes"@"2026.10.13.1"
INF extension·pull: Identity verified: "@swamp/kubernetes"@"2026.10.13.1"
INF extension·pull: Pulled "@swamp/kubernetes"@"2026.10.13.1"
INF extension·pull: Extracted 50 files:The repository now has the @swamp/kubernetes/pod type, along with the other Kubernetes types and the bundled workflows.
Point a pod behavior at the cluster
The rest of this tutorial uses a behavior named dev-pods of type @swamp/kubernetes/pod. If you have not created a behavior before, Create and Run a Behavior shows how. Its definition sets two global arguments, the namespace and the kubeconfig context:
globalArguments:
namespace: default
context: kind-devEvery method we run on dev-pods now goes to the default namespace through kind-dev.
List the kubeconfig contexts
Now we ask the behavior which kubeconfig contexts it can see:
swamp behavior run dev-pods listContextsThe listContexts method reads the local kubeconfig and writes the available contexts to Swamp data as a contextInfo resource.
List the pods
Next, we fetch the pods themselves:
swamp behavior run dev-pods listThe list method fetches every pod in the default namespace through the kind-dev context and writes one pod resource for each, with its phase, container statuses, conditions, IPs and restart counts.
What we built
We pulled the @swamp/kubernetes extension and used a pod behavior bound to one namespace and one kubeconfig context. We confirmed which contexts it can see, then read every pod in the namespace into Swamp data. The pod records from that run are now stored in the repository. They are the same data that the pod health summary guide builds on.