Translation completed. (#6055)

This commit is contained in:
Gau Liang 2019-12-11 17:33:43 +08:00 committed by Istio Automation
parent 547aea634a
commit bc2a114b74
1 changed files with 124 additions and 80 deletions

View File

@ -2,20 +2,21 @@
title: 使用 Istioctl 安装
description: 安装和自定义任何 Istio 配置文件以进行深入评估或用于生产。
weight: 10
keywords: [operator,kubernetes,helm]
keywords: [istioctl, kubernetes]
---
请按照本指南安装和配置 Istio 网格,以进行深入评估或用于生产。
如果您刚接触 Istio 或者只是要简单试用,请参考 [开始](/zh/docs/setup/getting-started) 文档进行操作。
本指南使用可以高度自定义 Istio 控制平面和数据平面的 [`istioctl`](/zh/docs/reference/commands/istioctl/) 命令行工具。
该命令行工具具有用户输入校验,可以防止错误的安装和自定义选项。
该命令行工具具有用户输入校验功能,可以防止错误的安装和自定义选项。
使用这些说明,您可以选择 Istio 的任何内置组件
[配置文件](/zh/docs/setup/additional-setup/config-profiles/) 然后根据您的特定需求进一步自定义配置。
使用这些命令说明,您可以选择 Istio 的任何内置 [配置文件](/zh/docs/setup/additional-setup/config-profiles/) 然后
根据您的特定需求进一步自定义配置。
## 先决条件{#prerequisites}
## 前提条件{#prerequisites}
开始之前,请检查以下先决条件:
开始之前,请检查以下前提条件:
1. [下载 Istio 发行版本](/zh/docs/setup/getting-started/#download)。
1. 执行任何必要的 [特定于平台的设置](/zh/docs/setup/platform-setup/)。
@ -29,9 +30,30 @@ keywords: [operator,kubernetes,helm]
$ istioctl manifest apply
{{< /text >}}
此命令在您定义的集群上安装 `default` 配置文件 Kubernetes 配置。
默认配置文件是一个很好的开始,用于建立生产环境,这与较大的 `demo` 配置文件不同,
用于评估广泛的 Istio 功能。
此命令将在您配置的 Kubernetes 集群上安装 `default` 配置文件。
`default` 配置文件建立生产环境的良好起点,这与旨在评估广泛的 Istio 功能特性的较大的 `demo` 配置文件不同。
如果要在 `default` 配置文件之上启用安全性,可以设置与安全相关的配置参数:
{{< text bash >}}
$ istioctl manifest apply --set values.global.mtls.enabled=true --set values.global.controlPlaneSecurityEnabled=true
{{< /text >}}
通常,您可以像使用 [helm](/zh/docs/setup/install/helm/) 一样在 `istioctl` 中配置 `--set` 标志。
唯一的区别是必须为配置路径增加 `values.` 前缀,因为这是 Helm 直通 API 的路径,如下所述。
## 从外部 Chart 安装{#install-from-external-charts}
通常,`istioctl` 使用内置 Chart 生成安装清单。这些 Chart 与 `istioctl` 一起发布,用于审核和自定义,它们
放置在 `install/kubernetes/operator/charts` 目录下。
除了使用内置 Chart 外,`istioctl` 还可以使用外部 Chart 生成安装清单。要选择外部 Chart ,请配置 `installPackagePath` 参数(接收本地文件系统路径):
{{< text bash >}}
$ istioctl manifest apply --set installPackagePath=~/istio-releases/istio-{{< istio_full_version >}}/install/kubernetes/operator/charts
{{< /text >}}
如果使用 `istioctl` {{< istio_full_version >}} 二进制文件,该命令执行结果与通过 `istioctl manifest apply` 安装相同,因为它指向的 Chart 与内置 Chart 相同。
除了试验或测试新特性之外,我们建议使用内置 Chart 而不是外部提供,以确保 `istioctl` 二进制文件与 Chart 的兼容性。
## 安装其他配置文件{#install-a-different-profile}
@ -48,10 +70,12 @@ $ istioctl manifest apply --set profile=demo
{{< text bash >}}
$ istioctl profile list
Istio configuration profiles:
minimal
demo
remote
sds
default
demo
{{< /text >}}
## 显示配置文件的配置{#display-the-configuration-of-a-profile}
@ -59,45 +83,30 @@ $ istioctl profile list
您可以查看配置文件的配置设置。 例如,通过以下命令查看 `default` 配置文件的设置:
{{< text bash >}}
$ istioctl profile dump
$ istioctl profile dump demo
autoInjection:
components:
injector:
enabled: true
k8s:
replicaCount: 1
strategy:
rollingUpdate:
maxSurge: 100%
maxUnavailable: 25%
enabled: true
configManagement:
cni:
components:
galley:
enabled: true
k8s:
replicaCount: 1
resources:
requests:
cpu: 100m
enabled: true
defaultNamespace: istio-system
gateways:
components:
egressGateway:
cni:
enabled: false
k8s:
hpaSpec:
maxReplicas: 5
metrics:
- resource:
name: cpu
targetAverageUtilization: 80
type: Resource
minReplicas: 1
enabled: false
...
{{< /text >}}
要查看整个配置的子集,可以使用 `--config-path` 标志,该标志仅选择部分给定路径下的配置:
{{< text bash >}}
$ istioctl profile dump --config-path trafficManagement.components.pilot
$ istioctl profile dump --config-path trafficManagement.components.pilot demo
enabled: true
k8s:
env:
@ -114,32 +123,13 @@ k8s:
- name: GODEBUG
value: gctrace=1
- name: PILOT_TRACE_SAMPLING
value: "1"
value: "100"
- name: CONFIG_NAMESPACE
value: istio-config
hpaSpec:
maxReplicas: 5
metrics:
- resource:
name: cpu
targetAverageUtilization: 80
type: Resource
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: istio-pilot
readinessProbe:
httpGet:
path: /ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 30
timeoutSeconds: 5
resources:
requests:
cpu: 500m
memory: 2048Mi
...
{{< /text >}}
## 显示配置文件中的差异{#show-differences-in-profiles}
@ -152,6 +142,19 @@ k8s:
$ istioctl profile dump default > 1.yaml
$ istioctl profile dump demo > 2.yaml
$ istioctl profile diff 1.yaml 2.yaml
gateways:
components:
egressGateway:
- enabled: false
+ enabled: true
...
requests:
- cpu: 100m
- memory: 128Mi
+ cpu: 10m
+ memory: 40Mi
strategy:
...
{{< /text >}}
## 安装前生成清单{#generate-a-manifest-before-installation}
@ -179,8 +182,31 @@ $ kubectl apply -f $HOME/generated-manifest.yaml
{{< text bash >}}
$ istioctl manifest generate > 1.yaml
$ istioctl manifest generate -f samples/pilot-k8s.yaml > 2.yaml
$ istioctl manifest generate -f samples/operator/pilot-k8s.yaml > 2.yaml
$ istioctl manifest diff 1.yam1 2.yaml
Differences of manifests are:
Object Deployment:istio-system:istio-pilot has diffs:
spec:
template:
spec:
containers:
'[0]':
resources:
requests:
cpu: 500m -> 1000m
memory: 2048Mi -> 4096Mi
nodeSelector: -> map[master:true]
tolerations: -> [map[effect:NoSchedule key:dedicated operator:Exists] map[key:CriticalAddonsOnly
operator:Exists]]
Object HorizontalPodAutoscaler:istio-system:istio-pilot has diffs:
spec:
maxReplicas: 5 -> 10
minReplicas: 1 -> 2
{{< /text >}}
## 验证安装成功{#verify-a-successful-installation}
@ -209,46 +235,55 @@ $ istioctl verify-install -f $HOME/generated-manifest.yaml
可以使用命令上的 `--set` 选项分别设置此 API 中的配置参数。 例如,要在默认配置文件中禁用遥测功能,请使用以下命令:
{{< text bash >}}
$ istioctl manifest apply --set telemetry.enabled=false
$ istioctl manifest apply --set values.global.mtls.enabled=true --set values.global.controlPlaneSecurityEnabled=true
{{< /text >}}
或者,可以使用 `istioctl``-f` 选项来指定具有完整配置的YAML文件
Alternatively, the `IstioControlPlane` configuration can be specified in a YAML file and passed to
`istioctl` using the `-f` option:
或者可以在YAML文件中指定 `IstioControlPlane` 配置,并使用 `-f` 选项将其传递给 `istioctlt`
{{< text bash >}}
$ istioctl manifest apply -f samples/pilot-k8s.yaml
$ istioctl manifest apply -f samples/operator/pilot-k8s.yaml
{{< /text >}}
### 识别 Istio 功能或组件{#identify-an-Istio-feature-or-component}
{{< tip >}}
为了向后兼容,还完全支持 [Helm 安装](/zh/docs/reference/config/installation-options/)。
若要在命令行中设置它们,请在选项名称前面加上 "`values.`"。
如下所示,下面命令就重写了 Helm 的 `pilot.traceSampling` 配置选项:
{{< text bash >}}
$ istioctl manifest apply --set values.pilot.traceSampling=0.1
{{< /text >}}
如 [Customize Istio settings using the Helm API](#customize-Istio-settings-using-the-helm-API) 所述Helm 值也可以在 `IstioControlPlane` 定义中设置。
{{< /tip >}}
### 标识 Istio 功能或组件{#identify-an-Istio-feature-or-component}
`IstioControlPlane` API 按功能对控制平面组件进行分组,如下表所示:
| 功能 | 组件 |
|---------|------------|
`Base` | CRDs
`Traffic Management` | Pilot
`Policy` | Policy
`Telemetry` | Telemetry
`Security` | Citadel
`Security` | Node agent
`Security` | Cert manager
`Configuration management` | Galley
`Gateways` | Ingress gateway
`Gateways` | Egress gateway
`AutoInjection` | Sidecar injector
`base` | `CRDs`
`trafficManagement` | `pilot`
`policy` | `policy`
`telemetry` | `telemetry`
`security` | `citadel`, `nodeAgent`, `certManager`
`configManagement` | `galley`
`gateways` | `ingressGateway`, `egressGateway`
`autoInjection` | `injector`
`coreDNS` | `coreDNS`
`thirdParty` | `cni`
除了核心的 Istio 组件之外,还提供了第三方附加功能和组件:
| 功能 | 组件 |
|---------|------------|
`Telemetry` | Prometheus
`Telemetry` | Prometheus Operator
`Telemetry` | Grafana
`Telemetry` | Kiali
`Telemetry` | Tracing
`ThirdParty` | CNI
`telemetry` | `prometheus`, `prometheusOperator`, `grafana`, `kiali`, `tracing`
可以启用或禁用功能,这可以启用或禁用作为功能一部分的所有组件。
可以通过组件,功能部件或全局设置组件安装到的名空间。
可以通过组件,功能部件或全局设置组件安装到的命名空间。
### 配置功能或组件设置{#configure-the-feature-or-component-settings}
@ -347,12 +382,20 @@ spec:
hpaSpec:
maxReplicas: 10 # ... default 5
minReplicas: 2 # ... default 1
nodeSelector:
master: "true"
tolerations:
- key: dedicated
operator: Exists
effect: NoSchedule
- key: CriticalAddonsOnly
operator: Exists
{{< /text >}}
使用 `manifest apply` 将修改后的设置应用于集群:
{{< text syntax="bash" repo="operator" >}}
$ istioctl manifest apply -f @samples/pilot-k8s.yaml@
$ istioctl manifest apply -f samples/operator/pilot-k8s.yaml
{{< /text >}}
### 使用 Helm API 自定义 Istio 设置{#customize-Istio-settings-using-the-helm-API}
@ -373,7 +416,8 @@ spec:
# global Helm settings
values:
monitoringPort: 15050
global:
monitoringPort: 15050
{{< /text >}}
一些参数将在 Helm 和 `IstioControlPlane` API 中暂时存在,包括 Kubernetes 资源,