#!/bin/bash
set -x
oldIP=`kubectl  get node  -o wide | grep k3s | awk '{print $6}'`
nodeIP=`ip addr | grep 'eth1' | grep 'inet ' | awk '{print $2}' | awk -F/ '{print $1}'`
sed -i 's#$oldIP#$nodeIP#g' /etc/systemd/system/k3s.service
systemctl daemon-reload
systemctl restart k3s
sleep 5s
kubectl get node -o wide
kubectl get pod -A -o wide
set +x
