Hệ thông istio trước giờ trước giờ vẫn đang chạy ngon.
Bỗng 1 ngày dev báo truy cập vào website thì bị chửi.
upstream connect error or disconnect/reset before headers. reset reason: connection failure, transport failure reason: TLS error: 268435581:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
1) Check expiration time
Chúng ta sẽ kiểm tra CERTIFICATE của các con:
– ingressgateway-istio.
– istio-proxy (sidecar injected to workload).
links:
https://istio.io/v1.8/docs/ops/configuration/security/root-transition/
kubectl exec [YOUR_POD] -c istio-proxy -n [YOUR_NAMESPACE] -- curl http://localhost:15000/certs | head -c 1000
Hoặc bạn exec vào container luôn và dùng câu lệnh:
http://localhost:15000/certs | head -c 1000
![](https://nimtechnology.com/wp-content/uploads/2021/11/image-287.png)
![](https://nimtechnology.com/wp-content/uploads/2021/11/image-288.png)
Như ngày hôm đó của tôi và expiration time thì cert chưa hết
1.1) renew certs
Mà nếu cert của bạn có hết hạn thì bạn run câu lệnh này. (tested on single cluster istio)
wget https://raw.githubusercontent.com/istio/tools/release-1.9/bin/root-transition.sh
chmod +x root-transition.sh
./root-transition.sh check-root
=====YOU HAVE 30 DAYS BEFORE THE ROOT CERT EXPIRES!=====
Bạn nhớ kiểm tra release-1.9 nhé
Chỗ này mình thấy nó ko có –context được nên bạn nhớ switch context của kubectl nhé.
List contexts
kubectl config get-contexts
Switch contexts
kubectl config set current-context MY-CONTEXT
Chuẩn bị mọi thứ OK rồi run thôi
./root-transition.sh root-transition
![](https://nimtechnology.com/wp-content/uploads/2021/11/image-289.png)
Động thời istio-ca-secret sẽ được cập nhật
Bạn có thể kiểm tra lại bằng command và content của file cert.
OK nếu cert cũng chưa expirate.
Log istiod, ingressgateway, proxy-istio ko có j đặc biệt.
2) Different time
Lúc đó tôi thử redeploy proxy-istio hay ingressgateway
mình lỗi túa ra:
![](https://nimtechnology.com/wp-content/uploads/2021/11/image-290.png)
Istio istiod < istio-proxy
nên cert allways expirate
failed to warm certificate: failed to generate workload certificate: create certificate: rpc error: code = Unavailable desc = connection error: desc = “transport: authentication handshake failed: x509: certificate has expired or is not yet valid: current time 2021-11-20T04:29:25Z is before 2021-11-20T11:14:51Z
2.1) check time of node
Lúc này bạn nên đi check date của các pod: istiod, ingressgateway-istio, sidecar istio-proxy.
Con nào sai giờ thì bạn có thể redeploy để nhảy sang node khác và check giờ của kube worker node ngay nhé.
2.2) try to config timezone of workload
Hoặc bạn có thể chỉnh timezone của pod “istiod, ingressgateway-istio, sidecar istio-proxy”
![](https://nimtechnology.com/wp-content/uploads/2021/11/image-291.png)
Bạn thêm vào environment của workload
- name: TZ
value: Asia/Saigon
Nói chung là có nhiêu cách thì chơi hết.
![](https://nimtechnology.com/wp-content/uploads/2021/11/image-292.png)
Trong lúc research thấy có bài của anh Tây, chắc nào rảnh coi
https://blog.christianposta.com/diving-into-istio-1-6-certificate-rotation/
3) sidecar istio-proxy
Sau khi mà anh em check giờ ngon nghe trên istiod và istio-ingressgateway ngon nghẻ òi.
thì đôi khi các sidecar istio-proxy sẽ bị lỗi sau
![](https://nimtechnology.com/wp-content/uploads/2021/11/image-309.png)
4)HOW TO CONFIGURE THE LIFETIME FOR ISTIO CERTIFICATES?
Thông tin này được lấy trang của istio
https://istio.io/latest/about/faq/security/#cert-lifetime-config
For the workloads running in Kubernetes, the lifetime of their Istio certificates is by default 24 hours.
This configuration may be overridden by customizing the proxyMetadata
field of the proxy configuration. For example:
proxyMetadata:
SECRET_TTL: 48h
Values over 90 days will not be accepted.