Linkerd 2.10 系列
- 快速上手 Linkerd v2.10 Service Mesh(服务网格)
- 腾讯云 K8S 集群实战 Service Mesh—Linkerd2 & Traefik2 部署 emojivoto 应用
- 详细了解 Linkerd 2.10 基础功能,一起步入 Service Mesh 微服务架构时代
- Linkerd 2.10—将您的服务添加到 Linkerd
- Linkerd 2.10—自动化的金丝雀发布
- Linkerd 2.10—自动轮换控制平面 TLS 与 Webhook TLS 凭证
- Linkerd 2.10—如何配置外部 Prometheus 实例
- Linkerd 2.10—配置代理并发
- Linkerd 2.10—配置重试
- Linkerd 2.10—配置超时
- Linkerd 2.10—控制平面调试端点
- Linkerd 2.10—使用 Kustomize 自定义 Linkerd 的配置
Linkerd 2.10 中文手册持续修正更新中:
为了支持网格化 Pod 之间的 mTLS 连接,
Linkerd 需要一个信任锚证书(trust anchor certificate)和一个带有相应 key 的颁发者证书(issuer certificate)。
使用 linkerd install 安装时,会自动生成这些证书。
或者,您可以使用 --identity-* 标志指定您自己的标志。
另一方面,使用 Helm 安装 Linkerd 时,无法自动生成它们,您需要提供它们。
您可以使用 openssl 或 step 等工具生成这些证书。
所有证书必须使用 ECDSA P-256 算法,这是 step 的默认值。
要使用 openssl 生成 ECDSA P-256 证书,您可以使用 openssl ecparam -name prime256v1 命令。
在本教程中,我们将向您介绍如何使用 step CLI 来执行此操作。
使用 step 生成证书
信任锚证书
首先使用其私钥(private key)生成根证书(使用 step 版本 0.10.1):
step certificate create root.linkerd.cluster.local ca.crt ca.key \
--profile root-ca --no-password --insecure
这将生成 ca.crt 和 ca.key 文件。
ca.crt 文件是使用 CLI 安装 Linkerd 时需要传递给 --identity-trust-anchors-file 选项的文件,
以及使用 Helm 安装 Linkerd 时的 identityTrustAnchorsPEM 值。
请注意,我们使用 --no-password --insecure 来避免使用密码短语(passphrase)加密这些文件。
对于寿命更长(longer-lived)的信任锚证书,
将 --not-after 参数传递给具有所需值的 step 命令(例如 --not-after=87600h)。
颁发者证书和 key
然后生成将用于签署 Linkerd 代理的 CSR 的中间证书(intermediate certificate)和密钥(key)对。
step certificate create identity.linkerd.cluster.local issuer.crt issuer.key \
--profile intermediate-ca --not-after 8760h --no-password --insecure \
--ca ca.crt --ca-key ca.key
这将生成 issuer.crt 和 issuer.key 文件。
将证书传递给 Linkerd
在使用 CLI 安装 Linkerd 时,您最终可以提供这些文件:
linkerd install \
--identity-trust-anchors-file ca.crt \
--identity-issuer-certificate-file issuer.crt \
--identity-issuer-key-file issuer.key \
| kubectl apply -f -
或者在使用 Helm 安装时:
helm install linkerd2 \
--set-file identityTrustAnchorsPEM=ca.crt \
--set-file identity.issuer.tls.crtPEM=issuer.crt \
--set-file identity.issuer.tls.keyPEM=issuer.key \
--set identity.issuer.crtExpiry=$(date -d '+8760 hour' +"%Y-%m-%dT%H:%M:%SZ") \
linkerd/linkerd2
对于低于 v3 的 Helm 版本,必须专门传递 --name 标志。
在 Helm v3 中,它已被弃用,并且是上面指定的第一个参数。
我是为少
微信:uuhells123
公众号:黑客下午茶
加我微信(互相学习交流),关注公众号(获取更多学习资料~)