Vaviloff / exp-k8s-exec

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Execute commands in pods and get result output in node.js

  1. Have a cluster (microk8s is a nice super fast way to start locally)

  2. Launch a minimum pod and connect to its shell:

kubectl run -i --tty busybox --image=busybox --restart=Never -- sh
  1. Create a sample file inside of the pod:
mkdir /example && echo '{ "id": "junx8nvi8visygivlxvgilx" }' > /example/data.json
  1. Run:
yarn
node index.js
  1. Should get result:
Exited with status: Success
Retrieved instance ID from pod: junx8nvi8visygivlxvgilx

About


Languages

Language:JavaScript 100.0%