在不创建 istiod 的情况下创建 Istio Ingress-gateway POD

Create Istio Ingress-gateway POD without creating istiod

我对 istio 有点陌生,仍在学习中。我有一个用例,其中 Istio 已经部署在 istio-system 命名空间中,但我需要使用 istioOperator 在 test-ns 命名空间中部署 istio ingress-gateway Pod。我正在使用 istio 1.6.7.

在 Istio 文档中,运行 提到了这个命令: istioctl manifest apply --set profile=default --filename=istio-ingress-values.yaml 但这将在 istio 系统中创建 istiod Pods,我不想要它,因为它已经创建了。

因此,我 运行 在 cmds 下仅创建 Ingress Gateway POD,但看不到任何 Pods 或在 test-ns 中创建的服务。如果可能,请提供帮助

kubectl apply -f istio-ingress-values.yaml
apiVersion: install.istio.io/v1alpha1
kind: IstioOperator
metadata:
    namespace: test-ns
    name: testoperator
    ingressGateways:
    - enabled: true
      name: istio-ingressgateway
      namespace: test-ns
      k8s:
        env:
        - name: ISTIO_META_ROUTER_MODE
          value: sni-dnat
        hpaSpec:
          maxReplicas: 5
          metrics:
          - resource:
              name: cpu
              targetAverageUtilization: 80
            type: Resource
          minReplicas: 1
          scaleTargetRef:
            apiVersion: apps/v1
            kind: Deployment
            name: istio-ingressgateway
        resources: {}
        service:
          ports:
          - name: http2
            port: 80
            targetPort: 80
          - name: https
            port: 443
            targetPort: 443

在 Istio 中可以调整 configuration profiles。 如我所见,您正在使用 default 配置文件,因此我将描述如何调整此配置文件以在 test-ns 命名空间中创建 istio-ingressgateway


我们可以通过 运行 istioctl profile dump default 命令显示默认配置文件设置。

首先,我将这些默认设置保存在 default_profile_dump.yml 文件中:

# istioctl profile dump default > default_profile_dump.yml

然后我修改了这个文件:
注意: 我只添加了一行:namespace: test-ns.

...
    ingressGateways:
    - enabled: true
      name: istio-ingressgateway
      namespace: test-ns
...

修改 ingressGateways 的默认设置后,我应用了这些新设置:

# istioctl manifest apply -f default_profile_dump.yml 
This will install the Istio 1.9.1 default profile with ["Istio core" "Istiod" "Ingress gateways"] components into the cluster. Proceed? (y/N) y
✔ Istio core installed                                                                                                                                   
✔ Istiod installed                                                                                                                                       
✔ Ingress gateways installed                                                                                                                             
- Pruning removed resources                                                                                                                                Removed HorizontalPodAutoscaler:istio-system:istio-ingressgateway.
  Removed PodDisruptionBudget:istio-system:istio-ingressgateway.
  Removed Deployment:istio-system:istio-ingressgateway.
  Removed Service:istio-system:istio-ingressgateway.
  Removed ServiceAccount:istio-system:istio-ingressgateway-service-account.
  Removed RoleBinding:istio-system:istio-ingressgateway-sds.
  Removed Role:istio-system:istio-ingressgateway-sds.
✔ Installation complete   

     

最后,我们可以检查 istio-ingressgateway 的部署位置:

# kubectl get pod -A | grep ingressgateway
test-ns        istio-ingressgateway-7fc7c7c-r92tw         1/1     Running   0          33s

istiod 部署在 istio-system 命名空间中保持完整:

# kubectl get deploy,pods -n istio-system
NAME                     READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/istiod   1/1     1            1           51m

NAME                          READY   STATUS    RESTARTS   AGE
pod/istiod-64675984c5-xl97n   1/1     Running   0          51m