一、確認(rèn)新證書已生效
# 檢查 secret 中的證書有效期
kubectl get secret <tls-secret-name> -o jsonpath='{.data.tls\.crt}' | base64 -d | openssl x509 -noout -dates
# 檢查證書指紋(確認(rèn)是否是新證書)
kubectl get secret <tls-secret-name> -o jsonpath='{.data.tls\.crt}' | base64 -d | openssl x509 -noout -fingerprint
二、檢查 ingress 引用
# 查看 Ingress 配置,確認(rèn)引用了正確的 secret
kubectl get ingress <ingress-name> -o yaml
# 重點(diǎn)檢查 tls 部分
kubectl get ingress <ingress-name> -o jsonpath='{.spec.tls[0]}' && echo
三、嘗試從外部測(cè)試
# 直接從外部測(cè)試證書
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