k8s命令行获取日志
#!/bin/bash service_list=("visitnew-service-" "visitnew-api") for service_li in ${service_list[@]} do service_name=`kubectl -n cbc get pod | grep -i $service_li | awk '{print $1}'` echo $service_li $service_name kubectl cp -n cbc $service_name:var/www/logs /root/visit-log/${service_li}/logs done job_list=("visitnew-serviceworker" "visitnewschedulejobs") for job_li in ${job_list[@]} do job_name=`kubectl -n cbc get pod | grep -i $job_li | awk '{print $1}'` echo $job_li $job_name kubectl cp -n cbc $job_name:var/www/bin/Debug/logs /root/visit-log/${job_li}/logs done