@kube-red/node-red-kube-red
v0.0.2
Published
A node-red node that supports interacting with kubernetes clusters (get, delete, create, list, watch, upsert)
Downloads
11
Readme
Kube RED
Kube-RED is a set of NodeRED nodes to interact with Kubernetes. It allows to automation of Kubernetes clusters with no or little code.
Installation
We provide a Helm chart to install Kube-RED in your Kubernetes cluster.
Kube-RED nodes
Currently, we provide the following nodes:
upsert
- Create or update a Kubernetes resourcedelete
- Delete a Kubernetes resourceget
- Get a Kubernetes resourcelist
- List Kubernetes resourcescreate
- Create a Kubernetes resourceupdate
- Update a Kubernetes resourcewatcher
- Watch Kubernetes resources
Configuration node cluster-config
is required to be added to the flow to
each node. It allows configuring the Kubernetes cluster to interact either
by providing a apiServer
URL, username
and password
or by using the inCluster
option to use the
service account token of the pod Kube-RED is running in.
Usage
By default, NodeRED manipulates objects in msg.payload
property.
Kube-RED nodes are using msg.object
property to store the Kubernetes object.
This way you can integrate with other nodes in the flow.
Upsert
Upsert node allows to create or update of Kubernetes resource. It uses the
create
and update
verbs under the hood.
Object to be created or updated is stored in msg.object
property and is injected
using inject
node.
See docs/examples/upsert.json
for an example flow.
Get/List/Delete
Get/List/Delete node allows primitive operations on Kubernetes resources. You can get resources using 2 ways:
- By providing a
version
,kind
name
andnamespace
ininject
nodemsg.object
payload - By configuring the node with
version
,kind
name
andnamespace
inside the node itself.
Using 1
you can dynamically get a resource based on the msg.object
payload, whereas using 2
you can
statically configure the node to get a resource when input is triggered.
See docs/examples/get.json
for an example flow.
Update
Update node allows updating Kubernetes resources. It uses the patch
verb under the hood.
So when you have a complex update scenario, you can provide a partial object in msg.object
payload
as long as it has apiVersion
, kind
, metadata.name
and metadata.namespace
will patch the resource.
See docs/examples/update.json
for an example flow.
Watcher
Watcher node allows watching Kubernetes resources. It uses the watch
verb under the hood.
It works by configuring the node with version
, kind
name
and namespace
inside the node itself.
When the resource is updated, the node will emit a message with the updated object in msg.object
property.
Note: Values in watcher should be lowercase and plural to match Kubernetes API. For example, Deployment
should be deployments
.
See docs/examples/watcher.json
for an example flow.