./log dev xxx

#!/bin/sh

if [ x"$1" = x ]; then
    echo "请输入环境参数(dev,test)"
    exit 1
fi

if [ x"$2" = x ]; then
    echo "请输入项目参数(xxx,xxx,xxx,)"
    exit 1
fi



pod=$(kubectl get pods -n env-$1 | grep $2 | awk '{print $1}');
echo 容器名:  $pod;
echo 指令:kubectl logs -f --tail=1 $pod  -n env-$1;
kubectl logs -f --tail=1 $pod  -n env-$1;

哒哒队长
7 声望4 粉丝