加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
teardown.sh 1.03 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
echo "Removing the Kubernetes manifests from this demo..."
kubectl delete -f kind/bot-deployment.yaml
kubectl delete -f kind/bot-service.yaml
kubectl delete -f kind/database-deployment.yaml
kubectl delete -f kind/database-pvc.yaml
kubectl delete -f kind/database-service.yaml
# Find all kubectl port-forward processes and kill them
echo "Identifying all kubectl port-forward processes..."
# Use pgrep to find the PIDs of the processes with 'kubectl port-forward' command
pids=$(pgrep -f "kubectl port-forward")
if [ -z "$pids" ]; then
echo "No kubectl port-forward processes found."
else
# Display the PIDs and kill them
for pid in $pids; do
echo "Terminating process with PID: $pid"
kill $pid
if [ $? -eq 0 ]; then
echo "Successfully terminated process with PID: $pid"
else
echo "Failed to terminate process with PID: $pid. You may need to run the script as root or use 'sudo'."
fi
done
fi
echo "All kubectl port-forward processes have been terminated."
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化