mirror of https://github.com/istio/istio.io.git
zh-translation:/docs/setup/install/istioctl/index.md (#6780)
* zh-translation-1799 * fix deployment-models lint error * fix some format * retouch * fix hpa lint error
This commit is contained in:
parent
c2714901a5
commit
dbe6b080f6
|
@ -85,7 +85,7 @@ Kubernetes 在每个集群都默认配置此行为,这有助于限制由错误
|
|||
link="multi-cluster.svg"
|
||||
alt="多集群服务网格"
|
||||
title="多集群"
|
||||
caption=多集群服务网格"
|
||||
caption="多集群服务网格"
|
||||
>}}
|
||||
|
||||
多集群部署可为您提供更大程度的隔离和可用性,但会增加复杂性。
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -33,10 +33,10 @@ $ istioctl manifest apply
|
|||
此命令将在您配置的 Kubernetes 集群上安装 `default` 配置文件。
|
||||
`default` 配置文件建立生产环境的良好起点,这与旨在评估广泛的 Istio 功能特性的较大的 `demo` 配置文件不同。
|
||||
|
||||
如果要在 `default` 配置文件之上启用安全性,可以设置与安全相关的配置参数:
|
||||
如果要在 `default` 配置文件之上启用 Grafana dashboard,用下面的命令设置 `addonComponents.grafana.enabled` 配置参数:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl manifest apply --set values.global.mtls.enabled=true
|
||||
$ istioctl manifest apply --set addonComponents.grafana.enabled=true
|
||||
{{< /text >}}
|
||||
|
||||
通常,您可以像使用 [helm](/zh/docs/setup/install/helm/) 一样在 `istioctl` 中配置 `--set` 标志。
|
||||
|
@ -49,7 +49,7 @@ $ istioctl manifest apply --set values.global.mtls.enabled=true
|
|||
除了使用内置 Chart 外,`istioctl` 还可以使用外部 Chart 生成安装清单。要选择外部 Chart ,请配置 `installPackagePath` 参数(接收本地文件系统路径):
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl manifest apply --set installPackagePath=~/istio-releases/istio-{{< istio_full_version >}}/install/kubernetes/operator/charts
|
||||
$ istioctl manifest apply --set installPackagePath=< base directory where installed >/istio-releases/istio-{{< istio_full_version >}}/install/kubernetes/operator/charts
|
||||
{{< /text >}}
|
||||
|
||||
如果使用 `istioctl` {{< istio_full_version >}} 二进制文件,该命令执行结果与通过 `istioctl manifest apply` 安装相同,因为它指向的 Chart 与内置 Chart 相同。
|
||||
|
@ -71,11 +71,12 @@ $ istioctl manifest apply --set profile=demo
|
|||
{{< text bash >}}
|
||||
$ istioctl profile list
|
||||
Istio configuration profiles:
|
||||
minimal
|
||||
remote
|
||||
sds
|
||||
separate
|
||||
default
|
||||
demo
|
||||
empty
|
||||
minimal
|
||||
{{< /text >}}
|
||||
|
||||
## 显示配置文件的配置{#display-the-configuration-of-a-profile}
|
||||
|
@ -84,29 +85,32 @@ Istio configuration profiles:
|
|||
|
||||
{{< text bash >}}
|
||||
$ istioctl profile dump demo
|
||||
autoInjection:
|
||||
components:
|
||||
injector:
|
||||
enabled: true
|
||||
k8s:
|
||||
replicaCount: 1
|
||||
strategy:
|
||||
rollingUpdate:
|
||||
maxSurge: 100%
|
||||
maxUnavailable: 25%
|
||||
enabled: true
|
||||
cni:
|
||||
components:
|
||||
cni:
|
||||
enabled: false
|
||||
enabled: false
|
||||
addonComponents:
|
||||
grafana:
|
||||
enabled: true
|
||||
kiali:
|
||||
enabled: true
|
||||
prometheus:
|
||||
enabled: true
|
||||
tracing:
|
||||
enabled: true
|
||||
components:
|
||||
egressGateways:
|
||||
- enabled: true
|
||||
k8s:
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 40Mi
|
||||
name: istio-egressgateway
|
||||
|
||||
...
|
||||
{{< /text >}}
|
||||
|
||||
要查看整个配置的子集,可以使用 `--config-path` 标志,该标志仅选择部分给定路径下的配置:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl profile dump --config-path trafficManagement.components.pilot demo
|
||||
$ istioctl profile dump --config-path components.pilot demo
|
||||
enabled: true
|
||||
k8s:
|
||||
env:
|
||||
|
@ -126,9 +130,6 @@ k8s:
|
|||
value: "100"
|
||||
- name: CONFIG_NAMESPACE
|
||||
value: istio-config
|
||||
hpaSpec:
|
||||
maxReplicas: 5
|
||||
metrics:
|
||||
...
|
||||
{{< /text >}}
|
||||
|
||||
|
@ -136,24 +137,22 @@ k8s:
|
|||
|
||||
`profile diff` 子命令可用于显示配置文件之间的差异,在将更改应用于集群之前,这对于检查自定义的效果很有用。
|
||||
|
||||
您可以使用以下命令显示默认配置文件和演示配置文件之间的差异:
|
||||
您可以使用以下命令显示 default 和 demo 配置文件之间的差异:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl profile dump default > 1.yaml
|
||||
$ istioctl profile dump demo > 2.yaml
|
||||
$ istioctl profile diff 1.yaml 2.yaml
|
||||
$ istioctl profile diff default demo
|
||||
gateways:
|
||||
components:
|
||||
egressGateway:
|
||||
- enabled: false
|
||||
+ enabled: true
|
||||
egressGateways:
|
||||
- - enabled: false
|
||||
+ - enabled: true
|
||||
...
|
||||
requests:
|
||||
- cpu: 100m
|
||||
- memory: 128Mi
|
||||
+ cpu: 10m
|
||||
+ memory: 40Mi
|
||||
strategy:
|
||||
k8s:
|
||||
requests:
|
||||
- cpu: 100m
|
||||
- memory: 128Mi
|
||||
+ cpu: 10m
|
||||
+ memory: 40Mi
|
||||
strategy:
|
||||
...
|
||||
{{< /text >}}
|
||||
|
||||
|
@ -230,15 +229,15 @@ $ istioctl verify-install -f $HOME/generated-manifest.yaml
|
|||
除了安装 Istio 的任何内置组件 [配置文件](/zh/docs/setup/additional-setup/config-profiles/),
|
||||
`istioctl manifest` 提供了用于自定义配置的完整 API。
|
||||
|
||||
- [`IstioControlPlane` API](/zh/docs/reference/config/istio.operator.v1alpha12.pb/)
|
||||
- [The `IstioOperator` API](/zh/docs/reference/config/istio.operator.v1alpha1/)
|
||||
|
||||
可以使用命令上的 `--set` 选项分别设置此 API 中的配置参数。 例如,要在 `default` 配置文件之上启用安全性,请使用以下命令:
|
||||
可以使用命令上的 `--set` 选项分别设置此 API 中的配置参数。 例如,要在 `default` 配置文件之上启用控制面安全特性,请使用以下命令:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl manifest apply --set values.global.mtls.enabled=true
|
||||
$ istioctl manifest apply --set values.global.controlPlaneSecurityEnabled=true
|
||||
{{< /text >}}
|
||||
|
||||
或者,可以在 YAML 文件中指定 `IstioControlPlane` 配置,并使用 `-f` 选项将其传给 `istioctl`:
|
||||
或者,可以在 YAML 文件中指定 `IstioOperator` 配置,并使用 `-f` 选项将其传给 `istioctl`:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl manifest apply -f samples/operator/pilot-k8s.yaml
|
||||
|
@ -253,34 +252,47 @@ $ istioctl manifest apply -f samples/operator/pilot-k8s.yaml
|
|||
$ 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` 定义中设置。
|
||||
如 [Customize Istio settings using the Helm API](#customize-Istio-settings-using-the-helm-API) 所述,Helm 值也可以在 `IstioOperator` 定义中设置。
|
||||
{{< /tip >}}
|
||||
|
||||
### 标识 Istio 功能或组件{#identify-an-Istio-feature-or-component}
|
||||
|
||||
`IstioControlPlane` API 按功能对控制平面组件进行分组,如下表所示:
|
||||
`IstioOperator` API 定义的 components 如下表所示:
|
||||
|
||||
| 功能 | 组件 |
|
||||
|---------|------------|
|
||||
`base` | `CRDs`
|
||||
`trafficManagement` | `pilot`
|
||||
`policy` | `policy`
|
||||
`telemetry` | `telemetry`
|
||||
`security` | `citadel`, `nodeAgent`, `certManager`
|
||||
`configManagement` | `galley`
|
||||
`gateways` | `ingressGateway`, `egressGateway`
|
||||
`autoInjection` | `injector`
|
||||
`coreDNS` | `coreDNS`
|
||||
`thirdParty` | `cni`
|
||||
| Components |
|
||||
| ------------|
|
||||
`base` |
|
||||
`pilot` |
|
||||
`proxy` |
|
||||
`sidecarInjector` |
|
||||
`telemetry` |
|
||||
`policy` |
|
||||
`citadel` |
|
||||
`nodeagent` |
|
||||
`galley` |
|
||||
`ingressGateways` |
|
||||
`egressGateways` |
|
||||
`cni` |
|
||||
|
||||
除了核心的 Istio 组件之外,还提供了第三方附加功能和组件:
|
||||
除了核心的 Istio 组件之外,还提供了第三方附加功能和组件。它们可以通过配置 `IstioOperator` API 的 `addonComponents` spec,或者使用 Helm 透传 API 来启动。
|
||||
|
||||
| 功能 | 组件 |
|
||||
|---------|------------|
|
||||
`telemetry` | `prometheus`, `prometheusOperator`, `grafana`, `kiali`, `tracing`
|
||||
{{< text yaml >}}
|
||||
apiVersion: install.istio.io/v1alpha1
|
||||
kind: IstioOperator
|
||||
spec:
|
||||
addonComponents:
|
||||
grafana:
|
||||
enabled: true
|
||||
{{< /text >}}
|
||||
|
||||
可以启用或禁用功能,这可以启用或禁用作为功能一部分的所有组件。
|
||||
可以通过组件,功能部件或全局设置组件安装到的命名空间。
|
||||
{{< text yaml >}}
|
||||
apiVersion: install.istio.io/v1alpha1
|
||||
kind: IstioOperator
|
||||
spec:
|
||||
values:
|
||||
grafana:
|
||||
enabled: true
|
||||
{{< /text >}}
|
||||
|
||||
### 配置功能或组件设置{#configure-the-feature-or-component-settings}
|
||||
|
||||
|
@ -294,59 +306,52 @@ $ istioctl manifest apply --set values.pilot.traceSampling=0.1
|
|||
要在默认配置配置文件中禁用遥测功能,请使用以下命令:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl manifest apply --set telemetry.enabled=false
|
||||
$ istioctl manifest apply --set components.telemetry.enabled=false
|
||||
{{< /text >}}
|
||||
|
||||
或者,您可以使用配置覆盖文件禁用遥测功能:
|
||||
|
||||
1. 创建一个文件 `telemetry_off.yaml` 文件并且写入以下内容:
|
||||
|
||||
{{< text yaml >}}
|
||||
apiVersion: install.istio.io/v1alpha2
|
||||
kind: IstioControlPlane
|
||||
spec:
|
||||
telemetry:
|
||||
enabled: false
|
||||
{{< /text >}}
|
||||
{{< text yaml >}}
|
||||
apiVersion: install.istio.io/v1alpha1
|
||||
kind: IstioOperator
|
||||
spec:
|
||||
components:
|
||||
telemetry:
|
||||
enabled: false
|
||||
{{< /text >}}
|
||||
|
||||
1. 将 `telemetry_off.yaml` 覆盖文件与 `manifest apply` 命令一起使用:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl manifest apply -f telemetry_off.yaml
|
||||
{{< /text >}}
|
||||
|
||||
您还可以使用这种方法来设置组件级配置,例如启用节点代理:
|
||||
|
||||
{{< text bash >}}
|
||||
$ istioctl manifest apply --set security.components.nodeAgent.enabled=true
|
||||
$ istioctl manifest apply -f telemetry_off.yaml
|
||||
{{< /text >}}
|
||||
|
||||
另一个定制是为功能部件和组件选择不同的命名空间。
|
||||
以下是一个定制命名空间的例子:
|
||||
|
||||
{{< text yaml >}}
|
||||
apiVersion: install.istio.io/v1alpha2
|
||||
kind: IstioControlPlane
|
||||
apiVersion: install.istio.io/v1alpha1
|
||||
kind: IstioOperator
|
||||
metadata:
|
||||
namespace: istio-system
|
||||
spec:
|
||||
defaultNamespace: istio-system
|
||||
security:
|
||||
namespace: istio-security
|
||||
components:
|
||||
citadel:
|
||||
namespace: istio-citadel
|
||||
components:
|
||||
citadel:
|
||||
namespace: istio-citadel
|
||||
{{< /text >}}
|
||||
|
||||
安装此文件将应用默认配置文件,并将组件安装到以下命名空间中:
|
||||
|
||||
- Citadel 组件 将被安装到 `istio-citadel` 命名空间
|
||||
- 所有其他安全相关的组件将被安装到 `istio-security` 命名空间
|
||||
- 剩余的 Istio 组件安装到 istio-system 命名空间
|
||||
|
||||
### 自定义 Kubernetes 设置{#customize-Kubernetes-settings}
|
||||
|
||||
`IstioControlPlane` API 允许以一致的方式自定义每个组件的 Kubernetes 设置。
|
||||
`IstioOperator` API 允许以一致的方式自定义每个组件的 Kubernetes 设置。
|
||||
|
||||
每一个组件都有一个允许修改配置的 [`KubernetesResourceSpec`](/zh/docs/reference/config/istio.operator.v1alpha12.pb/#KubernetesResourcesSpec)。使用此列表来标识要自定义的设置:
|
||||
每一个组件都有一个允许修改配置的 [`KubernetesResourceSpec`](/zh/docs/reference/config/istio.operator.v1alpha1/#KubernetesResourcesSpec),使用此列表来标识要自定义的设置:
|
||||
|
||||
1. [Resources](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/#resource-requests-and-limits-of-pod-and-container)
|
||||
1. [Readiness probes](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/)
|
||||
|
@ -359,34 +364,37 @@ spec:
|
|||
1. [Priority class name](https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/#priorityclass)
|
||||
1. [Node selector](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector)
|
||||
1. [Affinity and anti-affinity](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity)
|
||||
1. [Service](https://kubernetes.io/docs/concepts/services-networking/service/)
|
||||
1. [Toleration](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/)
|
||||
1. [Strategy](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/)
|
||||
1. [Env](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/)
|
||||
|
||||
所有这些 Kubernetes 设置都使用 Kubernetes API 定义,因此 [Kubernetes文档](https://kubernetes.io/docs/concepts/) 可以用作参考。
|
||||
|
||||
以下示例覆盖文件可调整 `TrafficManagement` 功能的资源和 pod 的自动水平缩放的 Pilot 设置:
|
||||
以下示例覆盖文件调整了 Pilot 的 resource 和 pod 水平自动伸缩的设置:
|
||||
|
||||
{{< text yaml >}}
|
||||
apiVersion: install.istio.io/v1alpha2
|
||||
kind: IstioControlPlane
|
||||
apiVersion: install.istio.io/v1alpha1
|
||||
kind: IstioOperator
|
||||
spec:
|
||||
trafficManagement:
|
||||
components:
|
||||
pilot:
|
||||
k8s:
|
||||
resources:
|
||||
requests:
|
||||
cpu: 1000m # override from default 500m
|
||||
memory: 4096Mi # ... default 2048Mi
|
||||
hpaSpec:
|
||||
maxReplicas: 10 # ... default 5
|
||||
minReplicas: 2 # ... default 1
|
||||
nodeSelector:
|
||||
master: "true"
|
||||
tolerations:
|
||||
- key: dedicated
|
||||
operator: Exists
|
||||
effect: NoSchedule
|
||||
- key: CriticalAddonsOnly
|
||||
operator: Exists
|
||||
components:
|
||||
pilot:
|
||||
k8s:
|
||||
resources:
|
||||
requests:
|
||||
cpu: 1000m # override from default 500m
|
||||
memory: 4096Mi # ... default 2048Mi
|
||||
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` 将修改后的设置应用于集群:
|
||||
|
@ -397,28 +405,23 @@ $ istioctl manifest apply -f samples/operator/pilot-k8s.yaml
|
|||
|
||||
### 使用 Helm API 自定义 Istio 设置{#customize-Istio-settings-using-the-helm-API}
|
||||
|
||||
`IstioControlPlane` API 使用 `values` 字段直接调用 [Helm API](/zh/docs/reference/config/installation-options/) 的接口对于字段进行设值。
|
||||
`IstioOperator` API 使用 `values` 字段直接调用 [Helm API](/zh/docs/reference/config/installation-options/) 的接口对字段进行设值。
|
||||
|
||||
下面的 YAML 文件可以通过 Helm API 配置全局和 Pilot 配置:
|
||||
|
||||
{{< text yaml >}}
|
||||
apiVersion: install.istio.io/v1alpha2
|
||||
kind: IstioControlPlane
|
||||
apiVersion: install.istio.io/v1alpha1
|
||||
kind: IstioOperator
|
||||
spec:
|
||||
trafficManagement:
|
||||
components:
|
||||
pilot:
|
||||
values:
|
||||
traceSampling: 0.1 # override from 1.0
|
||||
|
||||
# global Helm settings
|
||||
values:
|
||||
pilot:
|
||||
traceSampling: 0.1 # override from 1.0
|
||||
global:
|
||||
monitoringPort: 15050
|
||||
{{< /text >}}
|
||||
|
||||
一些参数将在 Helm 和 `IstioControlPlane` API 中暂时存在,包括 Kubernetes 资源,
|
||||
命名空间和启用设置。 Istio 社区建议使用 `IstioControlPlane` API,因为它更专一,经过验证并遵循[社区毕业流程](https://github.com/istio/community/blob/master/FEATURE-LIFECYCLE-CHECKLIST.md#feature-lifecycle-checklist)。
|
||||
一些参数将在 Helm 和 `IstioOperator` API 中暂时存在,包括 Kubernetes 资源,
|
||||
命名空间和启用设置。 Istio 社区建议使用 `IstioOperator` API,因为它更专一,经过验证并遵循[社区毕业流程](https://github.com/istio/community/blob/master/FEATURE-LIFECYCLE-CHECKLIST.md#feature-lifecycle-checklist)。
|
||||
|
||||
## 卸载 Istio{#uninstall-Istio}
|
||||
|
||||
|
|
Loading…
Reference in New Issue