https://github.com/travisghansen/node-red-contrib-kubernetes-client
Node-RED node for interacting with Kubernetes clusters
https://github.com/travisghansen/node-red-contrib-kubernetes-client
api k8s kubernetes node-red node-red-contrib node-red-flow nodered
Last synced: 10 months ago
JSON representation
Node-RED node for interacting with Kubernetes clusters
- Host: GitHub
- URL: https://github.com/travisghansen/node-red-contrib-kubernetes-client
- Owner: travisghansen
- License: mit
- Created: 2020-01-15T18:39:49.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T14:59:31.000Z (about 3 years ago)
- Last Synced: 2025-04-30T03:44:11.857Z (10 months ago)
- Topics: api, k8s, kubernetes, node-red, node-red-contrib, node-red-flow, nodered
- Language: JavaScript
- Size: 234 KB
- Stars: 11
- Watchers: 2
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# node-red-contrib-kubernetes-client
A `Node-RED` node that supports interacting with Kubernetes API via `watches` and `HTTP` requests.
[GitHub](https://github.com/travisghansen/node-red-contrib-kubernetes-client)
# Install
```
npm install --save node-red-contrib-kubernetes-client
```
# Documentation
The nodes are properly documented in `Node-RED` itself. In short there are 2 nodes:
- `kubernetes-client-watch` - produces messages for configured `watch` endpoints.
- `kubernetes-client-http` - allows complete interaction with Kubernetes API via **ALL** HTTP `endpoints` and `verbs` etc.
`Watches` ouput a `msg.payload` with the following structure (as a `json` object in `Node-RED` but shared here as `yaml` for readability):
```
# example event
---
type: ADDED || MODIFIED || DELETED || ERROR
object:
kind: ...
apiVersion: ...
metadata:
...
...
# example error
---
type: ERROR
object:
kind: Status
apiVersion: v1
metadata: {}
status: Failure
message: 'too old resource version: 1 (78390381)'
reason: Gone
code: 410
```
`msg.payload.object` contains the full resource from Kubernetes.
# Development
Some helpful command variants for testing/developing:
```
# show event output structure
kubectl -v6 get nodes --watch --output-watch-events -o yaml
# manually specify URL
kubectl -v6 get --raw '/api/v1/nodes?resourceVersion=1&watch=true'
# watch response error structure
---
type: ERROR
object:
kind: Status
apiVersion: v1
metadata: {}
status: Failure
message: 'too old resource version: 1 (78383979)'
reason: Gone
code: 410
```
# License
See [license](https://github.com/travisghansen/node-red-contrib-kubernetes-client/blob/master/LICENSE) (MIT).