Kubernetes icon

Kubernetes

Interact with Kubernetes

Overview

This node allows interaction with Kubernetes resources, specifically supporting various operations such as getting, listing, deleting, running, restarting, executing commands, patching, port forwarding, scaling, and fetching logs of Kubernetes objects. For the CronJobs resource with the Patch operation, it enables users to modify existing CronJob resources in a Kubernetes cluster by applying partial updates.

Common scenarios include automating updates to scheduled jobs (CronJobs) in Kubernetes without redeploying or fully replacing them. For example, you might patch a CronJob to change its schedule, update container images, or adjust job concurrency settings dynamically as part of a CI/CD pipeline or operational automation.

Properties

Name Meaning
Image The container image name used when running, restarting, executing, or patching pods.
Namespace The Kubernetes namespace where the CronJob resource resides. Defaults to "default".
Resource Name The specific name of the CronJob resource to target for the patch operation.

Note: Although the bundled code shows more properties, only these are relevant for the Patch operation on CronJobs based on your input.

Output

The node outputs JSON data representing the result of the patch operation on the targeted CronJob resource. This typically includes the updated resource's metadata and status as returned by the Kubernetes API after applying the patch.

If the operation involves running pods or executing commands, the output may also contain stdout from the pod execution, but this is not directly relevant for the Patch operation.

No binary data output is indicated for the Patch operation.

Dependencies

  • Requires access to a Kubernetes cluster with appropriate permissions to patch CronJob resources.
  • Needs an API authentication token or API key credential configured in n8n to authenticate against the Kubernetes API.
  • The node depends on an internal Kubernetes client utility (K8SClient) to communicate with the Kubernetes API.

Troubleshooting

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

  • Command must be an array!
    While not directly related to Patch, this error can occur if the Command property is incorrectly formatted when running pods. For Patch, ensure JSON inputs are valid if applicable.

  • Resource not found or permission denied errors
    These may occur if the specified CronJob name or namespace does not exist or if the credentials lack sufficient RBAC permissions to patch the resource.

  • Invalid patch format
    If the patch payload is malformed or does not conform to Kubernetes API expectations, the API will reject the request. Validate patch JSON before submitting.

Links and References

Discussion