安装后如何更新 Istio 配置?

How to update Istio configuration after installation?

我找到的每个文档都只告诉你如何 enable/disable 安装新的 Istio 实例时的功能。但我认为在很多情况下,人们需要更新 Istio 配置。

为什么没有 istioctl update 命令?

混淆是完全有道理的。至少在某个地方被召唤出来会很好。

基本上,没有更新命令的原因与没有 kubectl update 命令相同。 istioctl 所做的是生成 YAML 输出,它以声明的方式表示您的应用程序应该如何 运行。然后应用到集群上,由 Kubernetes 处理。

所以基本上 istioctl install 具有相同的值将产生相同的输出,并且当应用于 Kubernetes 时,如果没有更改,则不会更新任何内容。

我会把你的问题改写得更准确,我相信上下文是一样的:

  1. 如何找到 Istio 安装配置

    • 在安装之前,您应该generated the manifest。这可以用

      来完成
      istioctl manifest generate <flags-you-use-to-install-Istio> > $HOME/istio-manifest.yaml
      

      使用此清单,您可以检查正在安装的内容,并跟踪随时间对清单所做的更改。
      这还将捕获对底层图表的任何更改(如果与 Helm 一起安装)。只需在命令中添加 -f 标志:

      istioctl manifest generate -f path/to/manifest.yaml > $HOME/istio-manifest.yaml
      
    • 如果没有可用的manifest,可以检查IstioOperator CustomResource,但Istio必须安装operator才能使用。

    • 如果以上都没有,那你就倒霉了。这不是最佳情况,但这是我们得到的。

  2. 如何自定义 Istio 安装

    • 使用IstioOperator
      您可以将 YAML 格式的新配置传递给 istioctl install
      echo '
      apiVersion: install.istio.io/v1alpha1
      kind: IstioOperator
      spec:
        components:
          pilot:
            k8s:
              resources:
                requests:
                  cpu: 1000m # override from default 500m
                  memory: 4096Mi # ... default 2048Mi
              hpaSpec:
                maxReplicas: 10 # ... default 5
                minReplicas: 2  # ... default 1
      ' | istioctl install -f -
      
      以上示例调整了Pilot
    • 的资源和水平pod自动缩放设置
    • 任何其他配置(ServiceEntryDestinationRule 等)的部署方式与使用 kubectl apply 的任何其他资源一样。
  3. 为什么没有istioctl update命令

    因为#2。使用 istioctl install.

    应用对 Istio 的更改

    如果你想将 Istio 升级到更新的版本,文档中有 instructions

好兄弟,我注册了一个账号来发言。找了很久怎么更新istio,比如全局网格的配置。看到你的 post 和下面的答案后,我终于有了答案。 我之前的操作是创建两个配置,一个是istiod配置,一个是ingress配置。当我执行 istioctl install -f istiod.yaml 时,我的 ingress 会被删除,这让我很困扰。 直到我看到这个post,我明白了 我把两个文件合二为一了,下面是我的文件,不用删除我的ingress配置就可以更新

apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
spec:
  profile: minimal
  meshConfig:
    accessLogFile: /dev/stdout
    accessLogEncoding: TEXT
    enableTracing: true
    defaultConfig:
      tracing:
        zipkin:
          address: jaeger-collector.istio-system:9411
        sampling: 100
  components:
    ingressGateways:
    -name: ingressgateway
      namespace: istio-ingress
      enabled: true
      label:
        # Set a unique label for the gateway. This is required to ensure Gateways
        # can select this workload
        istio: ingressgateway
  values:
    gateways:
      istio-ingressgateway:
        # Enable gateway injection
        injectionTemplate: gateway

非常感谢,这个post解决了我的烦恼