查询证书有效期

一、确认新证书已生效

# 检查 secret 中的证书有效期
kubectl get secret <tls-secret-name> -o jsonpath='{.data.tls\.crt}' | base64 -d | openssl x509 -noout -dates

# 检查证书指纹(确认是否是新证书)
kubectl get secret <tls-secret-name> -o jsonpath='{.data.tls\.crt}' | base64 -d | openssl x509 -noout -fingerprint

二、检查 ingress 引用

# 查看 Ingress 配置,确认引用了正确的 secret
kubectl get ingress <ingress-name> -o yaml

# 重点检查 tls 部分
kubectl get ingress <ingress-name> -o jsonpath='{.spec.tls[0]}' && echo

三、尝试从外部测试

# 直接从外部测试证书
openssl s_client -connect android-iaas-test.sysop.tingyutech.net:443 -servername <domain-name> 2>/dev/null | openssl x509 -noout -dates

四、附录

# 批量检查
kubectl get secret -A | awk '{print $1,$2}' | while read i y; do
  kubectl get secret $y -n $i -o jsonpath='{.data.tls\.crt}' 2>/dev/null | base64 -d | openssl x509 -noout -dates 2>/dev/null && echo "Namespace: $i, Secret: $y"
done
posted @ 2025-11-05 17:07  龍龍小宝  阅读(3)  评论(0)    收藏  举报