マスター側のVMですべて操作
m=192.168.33.11 # IPアドレス of マスターVM
a=192.168.33.12 # IPアドレス of エージェントVM
u="https://$m:6443" # マスターのエンドポイント
# マスター構築
sudo ufw disable
curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 644 --node-ip=$m
# エージェント接続用トークン取得
t=$(sudo cat /var/lib/rancher/k3s/server/node-token | tee /dev/stderr)
# ssh経由でエージェント構築
ssh $a sh -x <<...
sudo ufw disable
curl -sfL https://get.k3s.io | K3S_URL=$u K3S_TOKEN=$t sh -s - --node-ip=$a
...