Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node allows interaction with a Kubernetes cluster by performing various operations on Kubernetes resources. Specifically for the Restart operation on the Default resource, it enables restarting pods or other specified Kubernetes resources within a given namespace.

Common scenarios where this node is beneficial include:

  • Automating the restart of pods after configuration changes or updates.
  • Managing Kubernetes workloads programmatically without direct kubectl usage.
  • Integrating Kubernetes control into broader automation workflows.

For example, you can use this node to restart a pod in the "default" namespace by specifying the pod's name and triggering the restart operation, which helps recover from transient errors or apply new configurations.

Properties

Name Meaning
Image The container image name used when running or restarting pods (required for some operations).
Namespace The Kubernetes namespace where the resource resides; defaults to "default".
Resource Name The specific name of the Kubernetes resource (e.g., pod name) to target for the operation.

Output

The node outputs JSON data representing the result of the Kubernetes operation performed. For the Restart operation, the output typically includes the standard output (stdout) from running the pod restart command or related API response details.

The output JSON structure contains execution metadata linked to each input item, allowing correlation between inputs and their respective results.

If binary data were involved (not indicated here), it would represent files or logs retrieved from Kubernetes resources.

Dependencies

  • Requires an API authentication token or credentials to access the Kubernetes cluster.
  • Needs proper n8n credential configuration to securely store and provide these Kubernetes credentials.
  • Depends on a Kubernetes client utility internally to communicate with the Kubernetes API.

Troubleshooting

  • No credentials got returned!
    This error indicates missing or misconfigured Kubernetes credentials. Ensure that valid credentials are set up in n8n and correctly referenced by the node.

  • Command must be an array!
    When running commands (e.g., in run operation), the command property must be a JSON array. Verify the input format matches this requirement.

  • If the restart operation fails, check that the specified resource name and namespace exist and that the user has sufficient permissions in the Kubernetes cluster.

  • Network connectivity issues to the Kubernetes API server can cause failures; verify network access and endpoint correctness.

Links and References

Discussion