Skip to content

Workflow file for this run

name: Multi node cluster with managed runners, Ubuntu, Kubespray
on:
push:
# branches: [ main ]
workflow_dispatch:
env:
num_nodes: 4
jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
nodes: ${{ steps.nodes.outputs.nodes }}
steps:
- id: nodes
run: |
nodes=$(python -c "print(list(range($num_nodes)))")
echo nodes="$nodes" >>$GITHUB_OUTPUT
control-node:
runs-on: ubuntu-latest
steps:
- run: |
set -vx
hostname -i >control-node-ip.txt
ssh-keygen -q -b 2048 -t rsa -N '' -C 'cluster key' -f ~/.ssh/id_rsa
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
cp ~/.ssh/id_rsa.pub .
sudo iptables -S
sudo iptables -D -P FORWARD DROP
sudo cat /var/log/auth.log
- name: Upload control node data
uses: actions/upload-artifact@v4
with:
name: control-node
path: |
control-node-ip.txt
id_rsa.pub
- run: |
set -vx
#ssh -o StrictHostKeyChecking=no $(hostname -i) echo hello
ip addr
ps -ef
sleep 200
nodes:
needs: [define-matrix]
runs-on: ubuntu-latest
strategy:
matrix:
id: ${{ fromJSON(needs.define-matrix.outputs.nodes) }}
steps:
- run: |
sleep 60
- uses: actions/download-artifact@v4
with:
name: control-node
- run: |
set -vx
# sudo iptables -P INPUT ACCEPT
# sudo iptables -P OUTPUT ACCEPT
# sudo iptables -P FORWARD ACCEPT
# sudo iptables -F
echo ${{ matrix.id }}
ip=$(cat control-node-ip.txt)
mkdir .ssh
chmod 700 .ssh
chmod 600 id_rsa.pub
mv id_rsa.pub .ssh/
ip addr
ssh -o StrictHostKeyChecking=no $ip echo hello