Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node allows interaction with Kubernetes clusters by performing various operations on Kubernetes resources. Specifically, the Delete operation deletes a specified resource within a given namespace. This is useful for automating cleanup tasks, managing lifecycle of pods, services, deployments, and other Kubernetes objects directly from an n8n workflow.

Common scenarios include:

  • Automatically deleting pods or jobs after completion.
  • Removing obsolete services or deployments as part of CI/CD pipelines.
  • Managing cluster resources programmatically without manual kubectl commands.

Example: Deleting a pod named "my-pod" in the "default" namespace to free up resources after a job finishes.

Properties

Name Meaning
Namespace The Kubernetes namespace where the resource exists. Defaults to "default".
Resource Name The name of the specific Kubernetes resource to delete (e.g., pod name).

Output

The output is a JSON array containing the result of the delete operation. The exact structure depends on the Kubernetes API response but generally includes metadata about the deleted resource or confirmation of deletion.

No binary data output is produced by this operation.

Dependencies

  • Requires valid Kubernetes API credentials configured in n8n to authenticate requests.
  • Depends on a Kubernetes client utility (K8SClient) internally to communicate with the Kubernetes API.
  • The node expects the Kubernetes cluster to be accessible from the environment where n8n runs.

Troubleshooting

  • No credentials got returned!
    This error indicates missing or misconfigured Kubernetes API credentials. Ensure that the required API authentication token or key is properly set up in n8n credentials.

  • Resource not found or cannot be deleted
    If the specified resource name does not exist in the given namespace, the Kubernetes API will return an error. Verify the resource name and namespace are correct.

  • Permission denied errors
    The API credentials used must have sufficient permissions to delete the specified resource type in the target namespace.

  • Invalid input types
    For example, if the command property (used in other operations) is not an array, an error is thrown. While not relevant for Delete, ensure all inputs conform to expected types.

Links and References

Discussion