zh-translation/about/faq/security/mysql-with-mtls.md (#9955)

* zh-translation/about/faq/security/mysql-with-mtls.md

* fix: error in symbol
This commit is contained in:
youhonglian 2021-07-06 19:34:41 +08:00 committed by GitHub
parent 84cae80c6f
commit 6a602cdc67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 47 deletions

View File

@ -5,51 +5,10 @@ weight: 95
keywords: [mysql,mtls]
---
您可能会发现安装 Istio 后 MySQL 无法连接。这是因为在 `demo` [安装配置](/zh/docs/setup/additional-setup/config-profiles/)中默认使用的 `PERMISSIVE` 模式不适用于 MySQL。您可能会看到类似于 `ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0` 的错误。
安装 Istio 后,您可能会发现 MySQL 无法连接。 这是因为 MySQL 是 [服务器优先](/zh/docs/ops/deployment/requirements/#server-first-protocols) 协议,
这会干扰 Istio 的协议检测。 特别是使用“PERMISSIVE”mTLS 模式可能会导致问题。
您可能会看到诸如 `ERROR 2013 (HY000): Lost connection to MySQL server at
'reading initial communication packet', system error: 0` 这样的错误。
有两种方法可以解决此问题。
1. 禁用双向 TLS。
如果不需要 Istio 双向 TLS您可以选择这种方法。您可以通过显式的禁用 MySQL 上的双向 TLS 来实现。
{{< text syntax="bash" >}}
$ kubectl apply -f - <<EOF
apiVersion: "authentication.istio.io/v1alpha1"
kind: "Policy"
metadata:
name: mysql-nomtls-authn
spec:
targets:
- name: YOUR-MYSQL-SERVICE # The name of *your* K8s Service
EOF
{{< /text >}}
1. 在 STRICT 模式下启用双向 TLS。
如果您需要为 MySQL 提供双向 TLS 保护,请使用目标规则和认证策略来启用双向 TLS。
{{< text syntax="bash" >}}
$ kubectl apply -f - <<EOF
apiVersion: "authentication.istio.io/v1alpha1"
kind: "Policy"
metadata:
name: mysql-mtls-authn
spec:
targets:
- name: YOUR-MYSQL-SERVICE # The name of *your* K8s Service
peers:
- mtls:
mode: STRICT
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: mysql-mtls-dr
spec:
host: YOUR-MYSQL-SERVICE # The name of *your* K8s Service
trafficPolicy:
tls:
mode: ISTIO_MUTUAL
EOF
{{< /text >}}
这可以通过确保使用 `STRICT``DISABLE` 模式或配置所有客户端来解决
发送 mTLS。 有关详细信息,请参阅 [服务器优先协议](/zh/docs/ops/deployment/requirements/#server-first-protocols)。