mirror of https://github.com/istio/istio.io.git
78 lines
31 KiB
HTML
78 lines
31 KiB
HTML
<!doctype html><html lang=zh itemscope itemtype=https://schema.org/WebPage><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=theme-color content=#466BB0><meta name=title content=延长自签发证书的有效期><meta name=description content="学习如何延长 Istio 自签发根证书的有效期。"><meta name=keywords content=microservices,services,mesh,security,PKI,certificate,Citadel><meta property=og:title content=延长自签发证书的有效期><meta property=og:type content=website><meta property=og:description content="学习如何延长 Istio 自签发根证书的有效期。"><meta property=og:url content=/v1.1/zh/help/ops/security/root-transition/><meta property=og:image content=/v1.1/img/istio-whitelogo-bluebackground-framed.svg><meta property=og:image:alt content="Istio Logo"><meta property=og:image:width content=112><meta property=og:image:height content=150><meta property=og:site_name content=Istio><meta name=twitter:card content=summary><meta name=twitter:site content=@IstioMesh><title>Istioldie 1.1 / 延长自签发证书的有效期</title><script async src="https://www.googletagmanager.com/gtag/js?id=UA-98480406-2"></script><script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
|
||
gtag('js',new Date());gtag('config','UA-98480406-2');</script><link rel=alternate type=application/rss+xml title="Istio Blog" href=/v1.1/feed.xml><link rel="shortcut icon" href=/v1.1/favicons/favicon.ico><link rel=apple-touch-icon href=/v1.1/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=icon type=image/png href=/v1.1/favicons/favicon-16x16.png sizes=16x16><link rel=icon type=image/png href=/v1.1/favicons/favicon-32x32.png sizes=32x32><link rel=icon type=image/png href=/v1.1/favicons/android-36x36.png sizes=36x36><link rel=icon type=image/png href=/v1.1/favicons/android-48x48.png sizes=48x48><link rel=icon type=image/png href=/v1.1/favicons/android-72x72.png sizes=72x72><link rel=icon type=image/png href=/v1.1/favicons/android-96x96.png sizes=96xW96><link rel=icon type=image/png href=/v1.1/favicons/android-144x144.png sizes=144x144><link rel=icon type=image/png href=/v1.1/favicons/android-192x192.png sizes=192x192><link rel=manifest href=/v1.1/manifest.json><meta name=apple-mobile-web-app-title content=Istio><meta name=application-name content=Istio><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Work+Sans:400|Chivo:400|Work+Sans:500,300,600,300italic,400italic,500italic,600italic|Chivo:500,300,600,300italic,400italic,500italic,600italic"><link rel=stylesheet href=/v1.1/css/all.css></head><body class="language-unknown archive-site"><script src=/v1.1/js/themes_init.min.js></script><script>const branchName="release-1.1";const docTitle="延长自签发证书的有效期";const iconFile="\/v1.1/img/icons.svg";const buttonCopy='复制到剪切板';const buttonPrint='打印';const buttonDownload='下载';</script><script src="https://www.google.com/cse/brand?form=search-form" defer></script><script src=/v1.1/js/all.min.js data-manual defer></script><header><nav><a id=brand href=/v1.1/zh/><span class=logo><svg viewBox="0 0 300 300"><circle cx="150" cy="150" r="146" stroke-width="2" /><path d="M65 240H225L125 270z"/><path d="M65 230l60-10V110z"/><path d="M135 220l90 10L135 30z"/></svg></span><span class=name>Istioldie 1.1</span></a><div id=hamburger><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#hamburger"/></svg></div><div id=header-links><a title="了解如何部署、使用和运维 Istio。" href=/v1.1/zh/docs/>文档</a>
|
||
<a title="关于使用 Istio 的博客文章。" href=/v1.1/zh/blog/2019/root-transition/>博客</a>
|
||
<span title="一堆帮助您部署、配置和使用 Istio 的资源。">帮助</span>
|
||
<a title=关于Istio的说明。 href=/v1.1/zh/about/>关于</a><div class=menu><button id=gearDropdownButton class=menu-trigger title=选项和设置 aria-label="Options and Settings" aria-controls=gearDropdownContent><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#gear"/></svg></button><div id=gearDropdownContent class=menu-content aria-labelledby=gearDropdownButton role=menu><a tabindex=-1 role=menuitem lang=en id=switch-lang-en>English</a>
|
||
<a tabindex=-1 role=menuitem lang=zh id=switch-lang-zh class=active>中文</a><div role=separator></div><a tabindex=-1 role=menuitem class=active id=light-theme-item>亮主题</a>
|
||
<a tabindex=-1 role=menuitem id=dark-theme-item>暗主题</a><div role=separator></div><a tabindex=-1 role=menuitem id=syntax-coloring-item>代码高亮</a><div role=separator></div><h6>本站的其它版本</h6><a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://istio.io/help\/ops\/security\/root-transition\/');return false;">当前版本</a>
|
||
<a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://preliminary.istio.io/help\/ops\/security\/root-transition\/');return false;">下个版本</a>
|
||
<a tabindex=-1 role=menuitem href=https://archive.istio.io>旧版本</a></div></div><button id=search-show title=搜索istio.io aria-label=Search><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#magnifier"/></svg></button></div><form id=search-form name=cse role=search><input type=hidden name=cx value=013699703217164175118:iwwf17ikgf4>
|
||
<input type=hidden name=ie value=utf-8>
|
||
<input type=hidden name=hl value=en>
|
||
<input type=hidden id=search-page-url value=/v1.1/search.html>
|
||
<input id=search-textbox class=form-control name=q type=search aria-label=搜索istio.io>
|
||
<button id=search-close title="Cancel search" type=reset aria-label="Cancel search"><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#cancel-x"/></svg></button></form></nav></header><main class=primary><div id=sidebar-container class="sidebar-container sidebar-offcanvas"><nav id=sidebar aria-label="Section Navigation"><div class=directory><div class=card><div id=header0 class=header title="一堆帮助您部署、配置和使用 Istio 的资源。"><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#help"/></svg>需要帮助吗?</div><div class="body default" aria-labelledby=header0><ul role=tree aria-expanded=true aria-labelledby=header0><li role=treeitem aria-label=运维指南><button class=show aria-hidden=true></button><a title="关于运行 Istio 网格的提示、技巧和窍门。" href=/v1.1/zh/help/ops/>运维指南</a><ul role=group aria-expanded=true><li role=none><a role=treeitem title=描述如何使用组件日志来深入了解运行组件的行为。 href=/v1.1/zh/help/ops/component-logging/>组件日志</a></li><li role=none><a role=treeitem title="描述如何使用 ControlZ 检测查看单个组件的运行状态。" href=/v1.1/zh/help/ops/controlz/>组件内检</a></li><li role=none><a role=treeitem title="如何从底层调试 Istio 组件。" href=/v1.1/zh/help/ops/component-debugging/>组件调试</a></li><li role=treeitem aria-label=流量管理><button aria-hidden=true></button><a title=帮助管理服务网格中的网络。 href=/v1.1/zh/help/ops/traffic-management/>流量管理</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="介绍 Istio 网络操作方面知识。" href=/v1.1/zh/help/ops/traffic-management/introduction/>网络运维介绍</a></li><li role=none><a role=treeitem title=提供特定的部署和配置指南。 href=/v1.1/zh/help/ops/traffic-management/deploy-guidelines/>部署和配置指南</a></li><li role=none><a role=treeitem title=常见网络相关问题的识别和处理。 href=/v1.1/zh/help/ops/traffic-management/troubleshooting/>网络问题排查</a></li><li role=none><a role=treeitem title=有关如何启用和理解本地负载均衡的信息。 href=/v1.1/zh/help/ops/traffic-management/locality-load-balancing/>本地负载均衡</a></li><li role=none><a role=treeitem title="用于对流量管理方面的 Envoy 配置问题进行检测的工具和技术。" href=/v1.1/zh/help/ops/traffic-management/proxy-cmd/>调试 Envoy 和 Pilot</a></li><li role=none><a role=treeitem title=介绍一些工具和技术,用来针对流量管理方面的配置问题进行诊断。 href=/v1.1/zh/help/ops/traffic-management/observing/>配置问题诊断</a></li></ul></li><li role=treeitem aria-label=安全><button class=show aria-hidden=true></button><a title=帮助你管理运行中的网格的安全性方面问题。 href=/v1.1/zh/help/ops/security/>安全</a><ul role=group aria-expanded=true class=leaf-section><li role=none><a role=treeitem title=展示授权功能的调试过程。 href=/v1.1/zh/help/ops/security/debugging-authorization/>调试授权</a></li><li role=none><a role=treeitem title="如果 Citadel 表现不正常该怎么办。" href=/v1.1/zh/help/ops/security/repairing-citadel/>修复 Citadel</a></li><li role=none><a role=treeitem title="如果您怀疑 Istio 密钥和证书有问题该怎么办。" href=/v1.1/zh/help/ops/security/keys-and-certs/>密钥和证书</a></li><li role=none><a role=treeitem title="如何处理 TLS 认证的失效问题。" href=/v1.1/zh/help/ops/security/mutual-tls/>双向 TLS</a></li><li role=none><a role=treeitem title="如何在启用双向 TLS 的情况下运行健康检查。" href=/v1.1/zh/help/ops/security/health-checks-and-mtls/>健康检查和双向 TLS</a></li><li role=none><a role=treeitem title=已经启用了授权,但是无论如何请求还是会通过。 href=/v1.1/zh/help/ops/security/authorization-permissive/>授权太过宽松</a></li><li role=none><a role=treeitem title=启用了授权然后任何请求都无法到达服务。 href=/v1.1/zh/help/ops/security/authorization-restrictive/>授权过于严格</a></li><li role=none><a role=treeitem title=如果终端用户身份验证不起作用,该怎么办。 href=/v1.1/zh/help/ops/security/end-user-auth/>终端用户身份验证</a></li><li role=none><span role=treeitem class=current title="学习如何延长 Istio 自签发根证书的有效期。">延长自签发证书的有效期</span></li></ul></li><li role=treeitem aria-label=遥测><button aria-hidden=true></button><a title=帮助您在一个运行的服务网格中管理遥测数据的采集和可视化。 href=/v1.1/zh/help/ops/telemetry/>遥测</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem href=/v1.1/zh/help/ops/telemetry/missing-metrics/>查看不到指标</a></li><li role=none><a role=treeitem title="处理 Grafana 相关问题。" href=/v1.1/zh/help/ops/telemetry/grafana/>Grafana</a></li><li role=none><a role=treeitem title="Envoy 统计数据的细粒度控制。" href=/v1.1/zh/help/ops/telemetry/envoy-stats/>Envoy 统计数据</a></li></ul></li><li role=treeitem aria-label=安装和设置><button aria-hidden=true></button><a title="帮助诊断和修复 Isto 安装问题。" href=/v1.1/zh/help/ops/setup/>安装和设置</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="概述了 Istio 使用 Kubernetes Webhook 及可能出现的相关问题。" href=/v1.1/zh/help/ops/setup/webhook/>动态准入 Webhook 概述</a></li><li role=none><a role=treeitem title="Istio 使用 Kubernetes webhook 进行服务器端配置验证的方式。" href=/v1.1/zh/help/ops/setup/validation/>配置验证 Webhook</a></li><li role=none><a role=treeitem title="描述了 Istio 如何使用 Kubernetes webhooks 进行自动 sidecar 注入。" href=/v1.1/zh/help/ops/setup/injection/>Sidecar 注入 Webhook</a></li><li role=none><a role=treeitem title="如何检查 Pod 中被许可的功能。" href=/v1.1/zh/help/ops/setup/required-pod-capabilities/>Pod 的必要功能</a></li><li role=none><a role=treeitem title="展示如何对 Istio service 进行健康检查。" href=/v1.1/zh/help/ops/setup/app-health-check/>Istio Service 健康检查</a></li></ul></li><li role=none><a role=treeitem title="关于解决 Istio 常见问题的建议。" href=/v1.1/zh/help/ops/misc/>杂项</a></li></ul></li><li role=treeitem aria-label=FAQ><button aria-hidden=true></button><a title=关于Istio的常见问题。 href=/v1.1/zh/help/faq/>FAQ</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title=常见问题。 href=/v1.1/zh/help/faq/general/>常见问题</a></li><li role=none><a role=treeitem title="安装 Q & A。" href=/v1.1/zh/help/faq/setup/>安装</a></li><li role=none><a role=treeitem title=安全方面的常见问题。 href=/v1.1/zh/help/faq/security/>安全</a></li><li role=none><a role=treeitem title="Mixer Q & A。" href=/v1.1/zh/help/faq/mixer/>Mixer</a></li><li role=none><a role=treeitem title=度量和日志的常见问题。 href=/v1.1/zh/help/faq/metrics-and-logs/>度量和日志</a></li><li role=none><a role=treeitem title="遥测 Q & A." href=/v1.1/zh/help/faq/telemetry/>遥测</a></li><li role=none><a role=treeitem title=分布式追踪问答。 href=/v1.1/zh/help/faq/distributed-tracing/>分布式追踪</a></li><li role=none><a role=treeitem title="流量管理 Q & A。" href=/v1.1/zh/help/faq/traffic-management/>流量管理</a></li></ul></li><li role=none><a role=treeitem title="Istio 常见的术语表。" href=/v1.1/zh/help/glossary/>术语表</a></li></ul></div></div></div></nav></div><div class=article-container><button tabindex=-1 id=sidebar-toggler title=折叠导航栏><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#pull"/></svg></button><nav aria-label=Breadcrumb><ol><li><a href=/v1.1/zh/>Istio</a></li><li><a href=/v1.1/zh/help/ title="一堆帮助您部署、配置和使用 Istio 的资源。">帮助</a></li><li><a href=/v1.1/zh/help/ops/ title="关于运行 Istio 网格的提示、技巧和窍门。">运维指南</a></li><li><a href=/v1.1/zh/help/ops/security/ title=帮助你管理运行中的网格的安全性方面问题。>安全</a></li><li>延长自签发证书的有效期</li></ol></nav><article aria-labelledby=title><div class=title-area><div><h1 id=title>延长自签发证书的有效期</h1><p class=byline><span title="416 字"><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#clock"/></svg><span> </span>阅读大约需要 2 分钟</span></p></div></div><nav class=toc-inlined aria-label="Table of Contents"><div><hr><ol><li role=none aria-label=场景><a href=#scenarios>场景</a><li role=none aria-label=根证书迁移过程><a href=#root-transition-procedure>根证书迁移过程</a><li role=none aria-label=常见问题><a href=#%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98>常见问题</a><ol><li role=none aria-label="我是不是可以先升级到 Istio 1.0.8、1.1.8 或者更新的版本之后,然后再更新根证书?"><a href=#%e6%88%91%e6%98%af%e4%b8%8d%e6%98%af%e5%8f%af%e4%bb%a5%e5%85%88%e5%8d%87%e7%ba%a7%e5%88%b0-istio-1-0-8-1-1-8-%e6%88%96%e8%80%85%e6%9b%b4%e6%96%b0%e7%9a%84%e7%89%88%e6%9c%ac%e4%b9%8b%e5%90%8e-%e7%84%b6%e5%90%8e%e5%86%8d%e6%9b%b4%e6%96%b0%e6%a0%b9%e8%af%81%e4%b9%a6>我是不是可以先升级到 Istio 1.0.8、1.1.8 或者更新的版本之后,然后再更新根证书?</a><li role=none aria-label="为什么我的工作负载没有载入新证书(步骤 5)?"><a href=#%e4%b8%ba%e4%bb%80%e4%b9%88%e6%88%91%e7%9a%84%e5%b7%a5%e4%bd%9c%e8%b4%9f%e8%bd%bd%e6%b2%a1%e6%9c%89%e8%bd%bd%e5%85%a5%e6%96%b0%e8%af%81%e4%b9%a6-%e6%ad%a5%e9%aa%a4-5>为什么我的工作负载没有载入新证书(步骤 5)?</a><li role=none aria-label="为什么我的 Pilot 不工作,并在日志中输出 “handshake error”?"><a href=#%e4%b8%ba%e4%bb%80%e4%b9%88%e6%88%91%e7%9a%84-pilot-%e4%b8%8d%e5%b7%a5%e4%bd%9c-%e5%b9%b6%e5%9c%a8%e6%97%a5%e5%bf%97%e4%b8%ad%e8%be%93%e5%87%ba-handshake-error>为什么我的 Pilot 不工作,并在日志中输出 “handshake error”?</a><li role=none aria-label="如何检查 Pilot 的 Sidecar"><a href=#how-to-check-if-pilot-has-an-envoy-sidecar>如何检查 Pilot 的 Sidecar</a><li role=none aria-label="无法使用 sidecar-injector 部署新的工作负载"><a href=#%e6%97%a0%e6%b3%95%e4%bd%bf%e7%94%a8-sidecar-injector-%e9%83%a8%e7%bd%b2%e6%96%b0%e7%9a%84%e5%b7%a5%e4%bd%9c%e8%b4%9f%e8%bd%bd>无法使用 sidecar-injector 部署新的工作负载</a></ol></li><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol><hr></div></nav><p>因为历史原因,Istio 的自签发证书只有一年的有效期。如果你选择使用 Istio 的自签发证书,就需要在它们过期之前订好计划进行根证书的更迭。根证书过期可能会导致集群范围内的意外中断。</p><div><aside class="callout tip"><div class=type><svg class="large-icon"><use xlink:href="/v1.1/img/icons.svg#callout-tip"/></svg></div><div class=content>我们认为每年更换根证书和密钥是一个安全方面的最佳实践,我们会在后续内容中介绍如何完成根证书和密钥的轮换过程。</div></aside></div><p>为了了解根证书的剩余有效期,请参考下面<a href=#root-transition-procedure>过程中的第一步</a>。</p><p>我们提供了下面的过程,用于完成根证书更新工作。Envoy 进程不需要进行重启来载入新的根证书,也就不会影响长链接了。要了解 Envoy 的热重启过程及其影响范围,请参考相关的<a href=https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/operations/hot_restart>文档</a>和<a href=https://blog.envoyproxy.io/envoy-hot-restart-1d16b14555b5>博客</a>。</p><h2 id=scenarios>场景</h2><p>如果目前没有使用双向 TLS 功能,未来也不准备使用,那么无需进行任何操作。可以选择升级到 1.0.8、1.1.8 或者更晚的版本,避免未来产生这一问题。</p><p>如果目前没有使用双向 TLS,但是未来准备采用,建议跟随下列步骤进行更新。</p><p>如果目前正在使用自签署证书支持的双向 TLS,请跟随下面的步骤进行操作,并检查当前部署是否受到影响。</p><h2 id=root-transition-procedure>根证书迁移过程</h2><ol><li><p>检查根证书是否过期:</p><p>下载<a href=https://raw.githubusercontent.com/istio/tools/master/bin/root-transition.sh>脚本</a>到一个包含有 <code>kubectl</code> 并能以此访问集群的机器上。</p><pre><code class=language-bash data-expandlinks=true>$ wget https://raw.githubusercontent.com/istio/tools/master/bin/root-transition.sh
|
||
$ chmod +x root-transition.sh
|
||
$ ./root-transition.sh check
|
||
...
|
||
===YOU HAVE 30 DAYS BEFORE THE ROOT CERT EXPIRES!=====
|
||
</code></pre><p>在根证书到期之前执行剩余步骤,以防系统停机。</p></li><li><p>执行根证书更新过程:</p><p>在更新过程中,Envoy 会用热重启的方式来载入新的证书。这可能对流量产生一定影响。
|
||
可以阅读 Envoy 热启动方面的相关<a href=https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/operations/hot_restart>文档</a>和<a href=https://blog.envoyproxy.io/envoy-hot-restart-1d16b14555b5>博客</a>,来了解更多细节。</p><div><aside class="callout warning"><div class=type><svg class="large-icon"><use xlink:href="/v1.1/img/icons.svg#callout-warning"/></svg></div><div class=content>如果你的 Pilot 没有 Envoy Sidecar,则应该给 Pilot 安装一个 Sidecar。这是因为 Pilot 在使用旧的根证书来验证新的工作负载证书时会出现问题,导致 Pilot 和 Evnoy 之间断开连接。请参考<a href=#how-to-check-if-pilot-has-an-envoy-sidecar>相关步骤</a>,以了解如何进行检查。<a href=/v1.1/zh/docs/setup/kubernetes/upgrade/steps/>Istio 升级指南</a>中缺省会为 Pilot 安装 Envoy Sidecar。</div></aside></div><pre><code class=language-bash data-expandlinks=true>$ ./root-transition.sh transition
|
||
Create new ca cert, with trust domain as cluster.local
|
||
Wed Jun 5 19:11:15 PDT 2019 delete old ca secret
|
||
secret "istio-ca-secret" deleted
|
||
Wed Jun 5 19:11:15 PDT 2019 create new ca secret
|
||
secret/istio-ca-secret created
|
||
pod "istio-citadel-8574b88bcd-j7v2d" deleted
|
||
Wed Jun 5 19:11:18 PDT 2019 restarted Citadel, checking status
|
||
NAME READY STATUS RESTARTS AGE
|
||
istio-citadel-8574b88bcd-l2g74 1/1 Running 0 3s
|
||
New root certificate:
|
||
Certificate:
|
||
Data:
|
||
...
|
||
Validity
|
||
Not Before: Jun 6 03:24:43 2019 GMT
|
||
Not After : Jun 3 03:24:43 2029 GMT
|
||
Subject: O = cluster.local
|
||
...
|
||
Your old certificate is stored as old-ca-cert.pem, and your private key is stored as ca-key.pem
|
||
Please save them safely and privately.
|
||
</code></pre></li><li><p>检查为工作负载新生成的证书:</p><pre><code class=language-bash data-expandlinks=true>$ ./root-transition.sh verify
|
||
...
|
||
Checking the current root CA certificate is propagated to all the Istio-managed workload secrets in the cluster.
|
||
Root cert MD5 is 8fa8229ab89122edba73706e49a55e4c
|
||
Checking namespace: default
|
||
Secret default.istio.default is updated.
|
||
Secret default.istio.sleep is updated.
|
||
Checking namespace: istio-system
|
||
Secret istio-system.istio.default is updated.
|
||
...
|
||
------All Istio keys and certificates are updated in secret!
|
||
</code></pre><p>Citadel 的证书分发过程需要一段时间来完成,因此命令失败,可以在几分钟之后再次尝试。</p></li><li><p>升级到 Istio 1.0.8、1.1.8 或更新的版本:</p><div><aside class="callout warning"><div class=type><svg class="large-icon"><use xlink:href="/v1.1/img/icons.svg#callout-warning"/></svg></div><div class=content>这一步骤能够确保控制平面组件和 Envoy Sidecar 全部载入新的证书和密钥</div></aside></div><p>将控制平面和 <code>istio-proxy</code> 升级到 1.0.8、1.1.8 或更新的版本。请依照 <a href=/v1.1/docs/setup/kubernetes/upgrade/steps/>Istio 更新过程</a>的介绍来完成这一步骤。</p></li><li><p>检查 Envoy 是否已经载入新的工作负载证书:</p><p>可以检查一下,Envoy 是否收到了新的证书。要检查命名空间 <code>bar</code> 之中一个名为 <code>foo</code> 的 Pod,验证它的 Envoy 证书的过程:</p><pre><code class=language-bash data-expandlinks=true>$ kubectl exec -it foo -c istio-proxy -n bar -- curl http://localhost:15000/certs | head -c 1000
|
||
{
|
||
"certificates": [
|
||
{
|
||
"ca_cert": [
|
||
...
|
||
"valid_from": "2019-06-06T03:24:43Z",
|
||
"expiration_time": ...
|
||
],
|
||
"cert_chain": [
|
||
{
|
||
...
|
||
}
|
||
</code></pre><p>查看 <code>ca_cert</code> 中的 <code>valid_from</code>。如果它符合步骤 2 中新证书的 <code>Not Before</code> 内容,则说明 Envoy 已经载入了新的根证书。</p></li></ol><h2 id=常见问题>常见问题</h2><h3 id=我是不是可以先升级到-istio-1-0-8-1-1-8-或者更新的版本之后-然后再更新根证书>我是不是可以先升级到 Istio 1.0.8、1.1.8 或者更新的版本之后,然后再更新根证书?</h3><p>是的。可以照常升级到 Istio 1.0.8、1.1.8 或者更新的版本。在升级之后,根据步骤 4 中的内容完成根证书更新,手工重启 Galley、Pilot 以及 sidecar-injector,从而载入新的根证书。</p><h3 id=为什么我的工作负载没有载入新证书-步骤-5>为什么我的工作负载没有载入新证书(步骤 5)?</h3><p>首先确认在步骤 4 中把 <code>istio-proxy</code> 升级到了 Istio 1.0.8、1.1.8 或者更新的版本。</p><div><aside class="callout warning"><div class=type><svg class="large-icon"><use xlink:href="/v1.1/img/icons.svg#callout-warning"/></svg></div><div class=content>如果使用的是 Istio 1.1.3-1.1.7,Envoy 可能不会因为新证书的生成而进行热重启。</div></aside></div><h3 id=为什么我的-pilot-不工作-并在日志中输出-handshake-error>为什么我的 Pilot 不工作,并在日志中输出 “handshake error”?</h3><p>这可能是因为启用 <code>controlPlaneSecurity</code> 的同时,Pilot 没有配置 <a href=#how-to-check-if-pilot-has-an-envoy-sidecar>Envoy Sidecar</a>。这种情况下,需要重启 Galley 和 Pilot 来保证它们载入了新证书。例如下面的命令通过删除 Pod 的方式重新部署 Galley 和 Pilot:</p><pre><code><pre><code class=language-bash data-expandlinks=true>$ kubectl delete po <galley-pod> -n istio-system
|
||
$ kubectl delete po <pilot-pod> -n istio-system
|
||
</code></pre></code></pre><h3 id=how-to-check-if-pilot-has-an-envoy-sidecar>如何检查 Pilot 的 Sidecar</h3><p>如果下面的命令中显示 <code>1/1</code>,说明 Pilot 没有 Sidecar;如果是 <code>2/2</code>,就表明 Pilot 是带有 Sidecar 的。</p><pre><code><pre><code class=language-bash data-expandlinks=true>$ kubectl get po -l istio=pilot -n istio-system
|
||
istio-pilot-569bc6d9c-tfwjr 1/1 Running 0 11m
|
||
</code></pre></code></pre><h3 id=无法使用-sidecar-injector-部署新的工作负载>无法使用 sidecar-injector 部署新的工作负载</h3><p>如果没有更新到 Istio 1.0.8、1.1.8 或者更新的版本,就有可能出现这种情况。请试着重新启动 Sidecar injector,重启之后就会载入证书:</p><pre><code class=language-bash data-expandlinks=true>$ kubectl delete po -l istio=sidecar-injector -n istio-system
|
||
pod "istio-sidecar-injector-788bd8fc48-x9gdc" deleted
|
||
</code></pre><nav id=see-also><h2>相关内容</h2><div class=see-also><div class=entry><p class=link><a data-skipendnotes=true href=/v1.1/zh/blog/2019/root-transition/>延长 Istio 自签发根证书的有效期</a></p><p class=desc>学习延长 Istio 自签发根证书的有效期的方法。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.1/zh/docs/tasks/security/vault-ca/>Istio Vault CA 集成</a></p><p class=desc>整合 Vault CA 到 Istio 中为双向 TLS 提供 支持。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.1/zh/blog/2018/istio-authorization/>基于 Istio 的 Micro-Segmentation 授权</a></p><p class=desc>描述 Istio 的授权功能以及如何在各种用例中使用它。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.1/zh/docs/tasks/security/health-check/>Citadel 的健康检查</a></p><p class=desc>如何在 Kubernetes 中启用 Citadel 的健康检查。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.1/zh/docs/tasks/security/authz-http/>HTTP 服务的访问控制</a></p><p class=desc>展示为 HTTP 服务设置基于角色的访问控制方法。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.1/zh/help/ops/setup/app-health-check/>Istio Service 健康检查</a></p><p class=desc>展示如何对 Istio service 进行健康检查。</p></div></div></nav></article><nav class=pagenav><div class=left><a title=如果终端用户身份验证不起作用,该怎么办。 href=/v1.1/zh/help/ops/security/end-user-auth/><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#left-arrow"/></svg>终端用户身份验证</a></div><div class=right></div></nav><div id=endnotes-container aria-hidden=true><h2>链接</h2><ol id=endnotes></ol></div></div><div class=toc-container><nav class=toc aria-label="Table of Contents"><div id=toc><ol><li role=none aria-label=场景><a href=#scenarios>场景</a><li role=none aria-label=根证书迁移过程><a href=#root-transition-procedure>根证书迁移过程</a><li role=none aria-label=常见问题><a href=#%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98>常见问题</a><ol><li role=none aria-label="我是不是可以先升级到 Istio 1.0.8、1.1.8 或者更新的版本之后,然后再更新根证书?"><a href=#%e6%88%91%e6%98%af%e4%b8%8d%e6%98%af%e5%8f%af%e4%bb%a5%e5%85%88%e5%8d%87%e7%ba%a7%e5%88%b0-istio-1-0-8-1-1-8-%e6%88%96%e8%80%85%e6%9b%b4%e6%96%b0%e7%9a%84%e7%89%88%e6%9c%ac%e4%b9%8b%e5%90%8e-%e7%84%b6%e5%90%8e%e5%86%8d%e6%9b%b4%e6%96%b0%e6%a0%b9%e8%af%81%e4%b9%a6>我是不是可以先升级到 Istio 1.0.8、1.1.8 或者更新的版本之后,然后再更新根证书?</a><li role=none aria-label="为什么我的工作负载没有载入新证书(步骤 5)?"><a href=#%e4%b8%ba%e4%bb%80%e4%b9%88%e6%88%91%e7%9a%84%e5%b7%a5%e4%bd%9c%e8%b4%9f%e8%bd%bd%e6%b2%a1%e6%9c%89%e8%bd%bd%e5%85%a5%e6%96%b0%e8%af%81%e4%b9%a6-%e6%ad%a5%e9%aa%a4-5>为什么我的工作负载没有载入新证书(步骤 5)?</a><li role=none aria-label="为什么我的 Pilot 不工作,并在日志中输出 “handshake error”?"><a href=#%e4%b8%ba%e4%bb%80%e4%b9%88%e6%88%91%e7%9a%84-pilot-%e4%b8%8d%e5%b7%a5%e4%bd%9c-%e5%b9%b6%e5%9c%a8%e6%97%a5%e5%bf%97%e4%b8%ad%e8%be%93%e5%87%ba-handshake-error>为什么我的 Pilot 不工作,并在日志中输出 “handshake error”?</a><li role=none aria-label="如何检查 Pilot 的 Sidecar"><a href=#how-to-check-if-pilot-has-an-envoy-sidecar>如何检查 Pilot 的 Sidecar</a><li role=none aria-label="无法使用 sidecar-injector 部署新的工作负载"><a href=#%e6%97%a0%e6%b3%95%e4%bd%bf%e7%94%a8-sidecar-injector-%e9%83%a8%e7%bd%b2%e6%96%b0%e7%9a%84%e5%b7%a5%e4%bd%9c%e8%b4%9f%e8%bd%bd>无法使用 sidecar-injector 部署新的工作负载</a></ol></li><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol></div></nav></div></main><footer><div class=user-links><a class=channel title="Go download Istio 1.1.9 now" href=https://github.com/istio/istio/releases/tag/1.1.9 aria-label="Download Istio"><span>download</span><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#download"/></svg>
|
||
</a><a class=channel title="加入 Istio discussion board 参与讨论获取帮助" href=https://discuss.istio.io aria-label="Istio discussion board"><span>discuss</span><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#discourse"/></svg></a>
|
||
<a class=channel title="Stack Overflow 中列举了针对实际问题以及部署、配置和使用 Istio 的各项回答" href=https://stackoverflow.com/questions/tagged/istio aria-label="Stack Overflow"><span>stack overflow</span><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#stackoverflow"/></svg></a>
|
||
<a class=channel title="关注我们的 Twitter 来获取最新信息" href=https://twitter.com/IstioMesh aria-label=Twitter><span>twitter</span><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#twitter"/></svg></a><div class=tag>对于用户</div></div><div class=info><p class=copyright>中文内容由 ServiceMesher 社区维护,部分文档可能稍微滞后于英文版本,同步工作持续进行中<br>Istio 归档
|
||
1.1.9<br>© 2019 Istio Authors, <a href=https://policies.google.com/privacy>隐私政策</a><br>归档于 2019年6月18日</p></div><div class=dev-links><a class=channel title="Istio 的代码在 GitHub 上开发" href=https://github.com/istio/community aria-label=GitHub><span>github</span><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#github"/></svg></a>
|
||
<a class=channel title="在 Slack 上与 Istio 社区交互讨论开发问题(仅限邀请)" href=https://istio.slack.com aria-label=slack><span>slack</span><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#slack"/></svg></a>
|
||
<a class=channel title="如果您想深入了解 Istio 的技术细节,请查看我们日益完善的设计文档" href=https://groups.google.com/forum/#!forum/istio-team-drive-access aria-label="team drive"><span>drive</span><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#drive"/></svg></a>
|
||
<a class=channel title="如果您想为 Istio 项目做出贡献,请考虑加入我们的工作组" href=https://github.com/istio/community/blob/master/WORKING-GROUPS.md aria-label="working groups"><span>working groups</span><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#working-groups"/></svg></a><div class=tag>对于开发者</div></div></footer><div id=scroll-to-top-container aria-hidden=true><button id=scroll-to-top title=回到顶部><svg class="icon"><use xlink:href="/v1.1/img/icons.svg#top"/></svg></button></div></body></html> |