This commit is contained in:
2025-12-05 18:13:42 +08:00
parent 46aac745c2
commit af9e99b444
17 changed files with 291 additions and 120 deletions

View File

@@ -0,0 +1,65 @@
#!/bin/bash
# 诊断 www.kevisual.cn 访问问题
# tags: debug, troubleshooting, traefik, ingress
# description: 诊断 www.kevisual.cn 无法访问的问题
# title: www.kevisual.cn 诊断脚本
# createdAt: 2025-12-05
echo "========================================"
echo "1. 检查 Traefik CRD 是否存在"
echo "========================================"
kubectl api-resources | grep ingressroute
echo ""
echo "========================================"
echo "2. 检查 IngressRoute 资源"
echo "========================================"
kubectl get ingressroute -n default
echo ""
echo "========================================"
echo "3. 检查 kevisual-external 服务"
echo "========================================"
kubectl get svc kevisual-external -n default
echo ""
echo "========================================"
echo "4. 检查 EndpointSlice"
echo "========================================"
kubectl get endpointslice -n default | grep kevisual
echo ""
echo "========================================"
echo "5. 检查 Traefik Pod 状态"
echo "========================================"
kubectl get pod -n traefik
echo ""
echo "========================================"
echo "6. 检查 Traefik 服务"
echo "========================================"
kubectl get svc -n traefik
echo ""
echo "========================================"
echo "7. 描述 www-kevisual-https IngressRoute"
echo "========================================"
kubectl describe ingressroute www-kevisual-https -n default 2>&1
echo ""
echo "========================================"
echo "8. 检查 Traefik 日志最近50行"
echo "========================================"
kubectl logs -n traefik -l app.kubernetes.io/name=traefik --tail=50 2>&1 | grep -i "kevisual\|www.kevisual\|error" || echo "未找到相关日志"
echo ""
echo "========================================"
echo "9. 测试访问 www.kevisual.cn"
echo "========================================"
curl -I https://www.kevisual.cn 2>&1 | head -10
echo ""
echo "========================================"
echo "10. 测试访问 kevisual.cn"
echo "========================================"
curl -I https://kevisual.cn 2>&1 | head -10

View File

@@ -0,0 +1,11 @@
# kubectl delete -f ./app.yaml --force --grace-period=0
# log
kubectl logs jimeng-api-cfd7c9578-dkqps
kubectl describe pod jimeng-api-cfd7c9578-dkqps
# kubectl rollout restart deployment jimeng-api -n default
# kubectl get pods -l app=jimeng-api -w

View File

@@ -0,0 +1,9 @@
# !/bin/bash
# 查看 traefik 日志中包含 jimeng 关键词的内容,以及错误信息
kubectl logs -n traefik $(kubectl get pods -n traefik -o name | head
-1) --tail=100 | grep -E "(jimeng|error|Error|ERROR)" -A 2 -B 2
kubectl get svc -n traefik
# 查看 traefik pod 的倒数 100 行日志
kubectl logs -n traefik $(kubectl get pods -n traefik -o name | head -1) --tail=100

View File

@@ -0,0 +1,15 @@
## k3s ctr 直接下载不了镜像,用其他的方式下载然后导入
# sudo k3s ctr images pull docker.io/rancher/mirrored-pause:3.6
# 1. 使用 Docker pull 镜像
docker pull docker.io/rancher/mirrored-pause:3.6
# 2. 将 Docker 镜像保存为 tar 文件
docker save docker.io/rancher/mirrored-pause:3.6 -o mirrored-pause-3.6.tar
# 3. 使用 K3s 的 ctr 导入镜像
sudo k3s ctr images import mirrored-pause-3.6.tar
# 4. 验证镜像是否导入成功
sudo k3s ctr images ls | grep pause

View File

@@ -0,0 +1,15 @@
## k3s ctr 直接下载不了镜像,用其他的方式下载然后导入
# sudo k3s ctr images pull docker.io/ghcr.io/iptag/jimeng-api:latest
# 1. 使用 Docker pull 镜像
docker pull docker.io/ghcr.io/iptag/jimeng-api:latest
# 2. 将 Docker 镜像保存为 tar 文件
docker save docker.io/ghcr.io/iptag/jimeng-api:latest -o mirrored-pause-3.6.tar
# 3. 使用 K3s 的 ctr 导入镜像
sudo k3s ctr images import mirrored-pause-3.6.tar
# 4. 验证镜像是否导入成功
sudo k3s ctr images ls | grep pause