Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node allows interaction with Kubernetes resources, specifically supporting operations on various resource types including DaemonSets. The "Scale" operation enables users to adjust the number of desired replicas for a given Kubernetes resource within a specified namespace.

Common scenarios where this node is beneficial include:

  • Automating scaling of DaemonSets in response to workload changes.
  • Integrating Kubernetes scaling actions into broader workflows or CI/CD pipelines.
  • Managing resource scaling without direct access to kubectl or Kubernetes dashboard.

For example, you can use this node to scale a DaemonSet named "log-collector" in the "default" namespace from 3 to 5 replicas as part of an automated deployment process.

Properties

Name Meaning
Namespace The Kubernetes namespace where the DaemonSet resides. Defaults to "default".
Resource Name The name of the DaemonSet resource to scale.

Note: Although the bundled code snippet does not explicitly show the internal handling of the "scale" operation, these properties are required inputs for specifying which DaemonSet to scale and where.

Output

The node outputs JSON data representing the result of the scaling operation. This typically includes the updated state of the DaemonSet resource after scaling, such as its current replica count and metadata.

If the node supports binary data output (not evident from the provided code), it would represent any raw data returned by Kubernetes API calls, but this is not indicated here.

Dependencies

  • Requires a valid Kubernetes API authentication credential configured in n8n to connect to the Kubernetes cluster.
  • The node depends on a Kubernetes client utility (K8SClient) internally to perform API requests.
  • Proper RBAC permissions in the Kubernetes cluster are necessary to perform scaling operations on DaemonSets.

Troubleshooting

  • No credentials got returned!
    This error occurs if the node cannot retrieve the required Kubernetes API credentials. Ensure that the credentials are properly set up and linked to the node.

  • Command must be an array!
    While not directly related to scaling, this error may appear if using the "run" operation with an invalid command format. For scaling, ensure input properties are correctly specified.

  • Permission Denied or Forbidden Errors
    If the Kubernetes user lacks permission to scale DaemonSets, the API will reject the request. Verify RBAC roles and bindings.

  • Resource Not Found
    If the specified DaemonSet name or namespace does not exist, the operation will fail. Double-check resource names and namespaces.

Links and References

Discussion