Skip to content

Kubernetes

Apply manifests, describe resources, get pods, logs, and scale deployments.

5 modules

ModuleDescription
Apply ManifestApply a Kubernetes manifest via kubectl apply
Describe ResourceDescribe a Kubernetes resource in detail
Get PodsList Kubernetes pods in a namespace
Get Pod LogsRetrieve logs from a Kubernetes pod
Scale DeploymentScale a Kubernetes deployment to a specified replica count

Modules

Apply Manifest

k8s.apply

Apply a Kubernetes manifest via kubectl apply

Parameters:

NameTypeRequiredDefaultDescription
manifeststringYes-Kubernetes manifest as YAML string or JSON object
namespacestringNo-Override namespace for the resource (optional)
kubeconfigstringNo-Path to kubeconfig file (uses default if not set)

Output:

FieldTypeDescription
kindstringResource kind (e.g. Deployment, Service)
namestringResource name
namespacestringResource namespace
actionstringAction taken (created, configured, unchanged)

Describe Resource

k8s.describe

Describe a Kubernetes resource in detail

Parameters:

NameTypeRequiredDefaultDescription
resource_typestringYes-Kubernetes resource type (e.g. pod, deployment, service)
namestringYes-Name of the resource to describe
namespacestringNodefaultKubernetes namespace (ignored for cluster-scoped resources)
kubeconfigstringNo-Path to kubeconfig file (uses default if not set)

Output:

FieldTypeDescription
resource_typestringResource type that was described
namestringResource name
namespacestringKubernetes namespace
descriptionstringFull kubectl describe output text

Get Pods

k8s.get_pods

List Kubernetes pods in a namespace

Parameters:

NameTypeRequiredDefaultDescription
namespacestringNodefaultKubernetes namespace to list pods from
label_selectorstringNo-Filter pods by label selector (e.g. app=nginx)
kubeconfigstringNo-Path to kubeconfig file (uses default if not set)

Output:

FieldTypeDescription
podsarrayList of pods with status information
countnumberTotal number of pods found

Get Pod Logs

k8s.logs

Retrieve logs from a Kubernetes pod

Parameters:

NameTypeRequiredDefaultDescription
podstringYes-Name of the pod to retrieve logs from
namespacestringNodefaultKubernetes namespace
containerstringNo-Specific container name (for multi-container pods)
tailnumberNo100Number of recent log lines to retrieve
previousbooleanNoFalseGet logs from the previous terminated container instance
kubeconfigstringNo-Path to kubeconfig file (uses default if not set)

Output:

FieldTypeDescription
podstringPod name
logsstringLog output text
linesnumberNumber of log lines returned

Scale Deployment

k8s.scale

Scale a Kubernetes deployment to a specified replica count

Parameters:

NameTypeRequiredDefaultDescription
deploymentstringYes-Name of the deployment to scale
replicasnumberYes-Desired number of replicas
namespacestringNodefaultKubernetes namespace
kubeconfigstringNo-Path to kubeconfig file (uses default if not set)

Output:

FieldTypeDescription
deploymentstringDeployment name
replicasnumberRequested replica count
namespacestringKubernetes namespace
scaledbooleanWhether the scale operation succeeded

Released under the Apache 2.0 License.