knix (1378B)
1 #!/usr/bin/env bash 2 3 # Create session if it doesn't exists 4 NAME=$1 5 shift 6 SESSIONNAME=kubernix-${NAME} 7 KUBERNIX_ROOT=${HOME}/var/kubernix/${NAME} 8 tmux new-session -s "${SESSIONNAME}" -d || true 9 10 # Main window 11 tmux send-keys -t "${SESSIONNAME}:0" "sudo kubernix --root=${KUBERNIX_ROOT} --nodes=3 --no-shell" C-m 12 tmux split-window -t ${SESSIONNAME}:0 -p 66 13 tmux rename-window -t ${SESSIONNAME}:0 kubernix 14 tmux send-keys -t "${SESSIONNAME}:0" "export KUBECONFIG=${KUBERNIX_ROOT}/kubeconfig/admin.kubeconfig" C-m 15 16 # Logs in other windows 17 # cri-o logs 18 tmux new-window -t ${SESSIONNAME}:1 -n cri-o tail -f ${KUBERNIX_ROOT}/crio/node-0/podman.log 19 tmux split-window -t ${SESSIONNAME}:1 tail -f ${KUBERNIX_ROOT}/crio/node-1/podman.log 20 tmux split-window -t ${SESSIONNAME}:1 tail -f ${KUBERNIX_ROOT}/crio/node-2/podman.log 21 22 # kubelet 23 tmux new-window -t ${SESSIONNAME}:2 -n kubelet tail -f ${KUBERNIX_ROOT}/kubelet/node-0/podman.log 24 tmux split-window -t ${SESSIONNAME}:2 tail -f ${KUBERNIX_ROOT}/kubelet/node-1/podman.log 25 tmux split-window -t ${SESSIONNAME}:2 tail -f ${KUBERNIX_ROOT}/kubelet/node-2/podman.log 26 27 # apiserver & controller-manager 28 tmux new-window -t ${SESSIONNAME}:3 -n k8s tail -f ${KUBERNIX_ROOT}/apiserver/kube-apiserver.log 29 tmux split-window -t ${SESSIONNAME}:3 tail -f ${KUBERNIX_ROOT}/controllermanager/kube-controller-manager.log 30 31 tmux select-window -t ${SESSIONNAME}:0