Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node enables interaction with Kubernetes clusters by performing various operations on Kubernetes resources. Specifically, for the ReplicaSets resource and the Patch operation, it allows users to modify existing ReplicaSet objects within a specified namespace. This is useful for updating configurations or metadata of ReplicaSets without recreating them.

Common scenarios include:

  • Updating container images or environment variables in ReplicaSets.
  • Adjusting labels or annotations dynamically.
  • Applying partial updates to ReplicaSets to change their behavior or scale.

For example, you might patch a ReplicaSet to update its pod template spec to use a new container image version.

Properties

Name Meaning
Image The container image name used when running or patching pods (shown for operations including patch).
Namespace The Kubernetes namespace where the ReplicaSet resides. Defaults to "default".
Resource Name The name of the specific ReplicaSet resource to patch.

Note: Although the bundled code shows other properties like command, they are not relevant for the Patch operation on ReplicaSets based on your input.

Output

The node outputs JSON data representing the result of the patch operation on the ReplicaSet. This typically includes the updated ReplicaSet object returned from the Kubernetes API after applying the patch.

The output JSON structure corresponds to the Kubernetes API response for the patched resource, containing fields such as metadata, spec, status, etc., reflecting the current state of the ReplicaSet after modification.

No binary data output is indicated for this operation.

Dependencies

  • Requires access to a Kubernetes cluster with appropriate permissions to patch ReplicaSets.
  • Needs an API authentication token or credentials configured in n8n to connect securely to the Kubernetes API.
  • The node depends on an internal Kubernetes client utility (K8SClient) to perform API calls.

Troubleshooting

  • No credentials got returned!
    This error occurs if the node cannot retrieve the required Kubernetes API credentials. Ensure that valid credentials are configured and selected in the node settings.

  • Command must be an array!
    Although not directly related to Patch, this error appears if the command property is provided but is not a valid JSON array. For Patch operations, this should not be set.

  • Resource not found or permission denied
    If the specified ReplicaSet name or namespace does not exist or the credentials lack patch permissions, the Kubernetes API will return an error. Verify resource names, namespaces, and RBAC permissions.

  • Invalid patch format
    The node’s source code snippet does not show explicit patch payload handling, so ensure that the patch data is correctly formatted and passed through the node’s parameters or upstream nodes.

Links and References

Discussion