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

问题描述

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

从 Istio 文档中,提到运行这个 cmd: istioctl manifest apply --set profile=default --filename=istio-ingress-values.yaml 但这会在 istio-system 中创建 istiod Pod,因为它已经创建了,我不想要它。

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

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 配置文件,因此我将介绍如何调整此配置文件以在 istio-ingressgateway 命名空间中创建 test-ns


我们可以通过运行 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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...