Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node enables interaction with Kubernetes clusters by performing various operations on Kubernetes resources. Specifically for the Namespaces resource and the Restart operation, it allows restarting a namespace-related resource (e.g., pods within a namespace) by running a container image that triggers the restart process.

Common scenarios where this node is beneficial include:

  • Automating the restart of workloads or services in a specific Kubernetes namespace after configuration changes.
  • Managing lifecycle events of Kubernetes resources programmatically within an n8n workflow.
  • Integrating Kubernetes management tasks into broader automation pipelines without manual kubectl commands.

For example, you might use this node to restart all pods in a namespace by specifying the namespace and the container image that performs the restart logic.

Properties

Name Meaning
Image The container image to use when running the restart operation. This image should contain the logic to perform the restart.
Namespace The Kubernetes namespace where the resource resides. Defaults to "default".
Resource Name The name of the specific resource within the namespace to target for the restart operation.

Output

The node outputs JSON data representing the result of the restart operation. Typically, this includes the standard output (stdout) from running the pod with the specified image and command, which can contain logs or status messages about the restart process.

If the node supports binary data output (not explicitly shown here), it would represent any binary content returned by the Kubernetes API or the executed pod, but for the Restart operation, the focus is on textual output indicating success or failure.

Dependencies

  • Requires access to a Kubernetes cluster with appropriate permissions to manage namespaces and related resources.
  • Needs an API authentication token or credentials configured in n8n to connect securely to the Kubernetes API.
  • Depends on a container image capable of executing the restart logic when run as a pod.

Troubleshooting

  • No credentials got returned!
    This error indicates missing or misconfigured Kubernetes credentials in n8n. Ensure that the API authentication token or credentials are properly set up and accessible by the node.

  • Command must be an array!
    Although not directly related to the Restart operation (which does not specify a command property in your input), if using operations like Run, ensure that the command parameter is a valid JSON array.

  • Resource not found or permission denied
    Verify that the specified namespace and resource name exist and that the credentials have sufficient permissions to perform the restart.

  • Image pull errors or pod startup failures
    Confirm that the specified container image is accessible from the Kubernetes cluster and that it contains the necessary logic to perform the restart.

Links and References

Discussion