Kubernetes Istio 入口网关始终响应 503

2024-04-14

我正在使用 Helm 配置 Istio。在这里你可以找到我的istio-config.yaml:

global:
  proxy:
    accessLogFile: "/dev/stdout"
    resources:
      requests:
        cpu: 10m
        memory: 40Mi

  disablePolicyChecks: false

sidecarInjectorWebhook:
  enabled: true
  rewriteAppHTTPProbe: false

pilot:
  autoscaleEnabled: false
  traceSampling: 100.0
  resources:
    requests:
      cpu: 10m
      memory: 100Mi

mixer:
  policy:
    enabled: true
    autoscaleEnabled: false
    resources:
      requests:
        cpu: 10m
        memory: 100Mi

  telemetry:
    enabled: true
    autoscaleEnabled: false
    resources:
      requests:
        cpu: 50m
        memory: 100Mi

  adapters:
    stdio:
      enabled: true

grafana:
  enabled: true

tracing:
  enabled: true

kiali:
  enabled: true
  createDemoSecret: true

gateways:
  istio-ingressgateway:
    autoscaleEnabled: false
    resources:
      requests:
        cpu: 10m
        memory: 40Mi

  istio-egressgateway:
    enabled: true
    autoscaleEnabled: false
    resources:
      requests:
        cpu: 10m
        memory: 40Mi

global:
  controlPlaneSecurityEnabled: false

  mtls:
    enabled: false

然后我使用部署了一堆微服务istioctl,都很简单REST使用 HTTP 进行调用。他们可以毫无问题地相互沟通。如果我用 NodePorts 暴露它们,我就可以正确地到达并与它们通信。

这是我的服务:

$ kubectl get svc --all-namespaces
NAMESPACE              NAME                             TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                                                                                                                                      AGE
default                activemq                         ClusterIP      None             <none>        61616/TCP                                                                                                                                    3h17m
default                activemq-np                      NodePort       10.110.76.147    <none>        8161:30061/TCP                                                                                                                               3h17m
default                api-exchange                     ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h16m
default                api-response                     ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h16m
default                authorization-server             ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h17m
default                de-communication                 ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h16m
default                gateway                          ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h17m
default                gateway-np                       NodePort       10.96.123.57     <none>        8080:30080/TCP                                                                                                                               3h17m
default                identity                         ClusterIP      None             <none>        88/TCP,8080/TCP                                                                                                                              3h18m
default                kubernetes                       ClusterIP      10.96.0.1        <none>        443/TCP                                                                                                                                      3h19m
default                matchengine                      ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h16m
default                monitor-redis                    ClusterIP      None             <none>        8081/TCP                                                                                                                                     3h17m
default                monitor-redis-np                 NodePort       10.106.178.13    <none>        8081:30082/TCP                                                                                                                               3h17m
default                postgres                         ClusterIP      None             <none>        5432/TCP                                                                                                                                     3h18m
default                postgres-np                      NodePort       10.106.223.216   <none>        5432:30032/TCP                                                                                                                               3h18m
default                redis                            ClusterIP      None             <none>        6379/TCP                                                                                                                                     3h18m
default                redis-np                         NodePort       10.101.167.194   <none>        6379:30079/TCP                                                                                                                               3h18m
default                synchronization                  ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h15m
default                tx-flow                          ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h15m
default                tx-manager                       ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h15m
default                tx-scheduler                     ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h15m
default                ubc-config                       ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h16m
default                ubc-services-config              ClusterIP      None             <none>        8888/TCP                                                                                                                                     3h18m
default                ubc-services-config-np           NodePort       10.110.11.213    <none>        8888:30088/TCP                                                                                                                               3h18m
default                user-admin                       ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h17m
default                web-exchange-np                  NodePort       10.105.244.194   <none>        80:30081/TCP                                                                                                                                 3h15m
istio-system           grafana                          ClusterIP      10.97.134.230    <none>        3000/TCP                                                                                                                                     3h22m
istio-system           istio-citadel                    ClusterIP      10.99.159.56     <none>        8060/TCP,15014/TCP                                                                                                                           3h22m
istio-system           istio-egressgateway              ClusterIP      10.97.71.204     <none>        80/TCP,443/TCP,15443/TCP                                                                                                                     3h22m
istio-system           istio-galley                     ClusterIP      10.98.111.27     <none>        443/TCP,15014/TCP,9901/TCP                                                                                                                   3h22m
istio-system           istio-ingressgateway             LoadBalancer   10.96.182.202    <pending>     15020:30936/TCP,80:31380/TCP,443:31390/TCP,31400:31400/TCP,15029:31913/TCP,15030:30606/TCP,15031:32127/TCP,15032:30362/TCP,15443:31416/TCP   3h22m
istio-system           istio-pilot                      ClusterIP      10.101.117.169   <none>        15010/TCP,15011/TCP,8080/TCP,15014/TCP                                                                                                       3h22m
istio-system           istio-policy                     ClusterIP      10.97.247.54     <none>        9091/TCP,15004/TCP,15014/TCP                                                                                                                 3h22m
istio-system           istio-sidecar-injector           ClusterIP      10.101.219.141   <none>        443/TCP                                                                                                                                      3h22m
istio-system           istio-telemetry                  ClusterIP      10.109.108.78    <none>        9091/TCP,15004/TCP,15014/TCP,42422/TCP                                                                                                       3h22m
istio-system           jaeger-agent                     ClusterIP      None             <none>        5775/UDP,6831/UDP,6832/UDP                                                                                                                   3h22m
istio-system           jaeger-collector                 ClusterIP      10.97.255.231    <none>        14267/TCP,14268/TCP                                                                                                                          3h22m
istio-system           jaeger-query                     ClusterIP      10.104.80.162    <none>        16686/TCP                                                                                                                                    3h22m
istio-system           kiali                            ClusterIP      10.104.41.71     <none>        20001/TCP                                                                                                                                    3h22m
istio-system           kiali-np                         NodePort       10.100.99.141    <none>        20001:30085/TCP                                                                                                                              29h
istio-system           prometheus                       ClusterIP      10.110.46.60     <none>        9090/TCP                                                                                                                                     3h22m
istio-system           tracing                          ClusterIP      10.111.173.205   <none>        80/TCP                                                                                                                                       3h22m
istio-system           zipkin                           ClusterIP      10.101.144.199   <none>        9411/TCP                                                                                                                                     3h22m
kube-system            kube-dns                         ClusterIP      10.96.0.10       <none>        53/UDP,53/TCP,9153/TCP                                                                                                                       54d
kube-system            tiller-deploy                    ClusterIP      10.105.162.195   <none>        44134/TCP                                                                                                                                    24d

我创建了一个入口网关和一个 VirtualService 来路由来自集群外部的调用。这是我的网关和虚拟服务配置:

Gateway:

$ kubectl describe gateway iris-gateway
Name:         iris-gateway
Namespace:    default
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"networking.istio.io/v1alpha3","kind":"Gateway","metadata":{"annotations":{},"name":"iris-gateway","namespace":"default"},"s...
API Version:  networking.istio.io/v1alpha3
Kind:         Gateway
Metadata:
  Creation Timestamp:  2019-08-23T17:25:20Z
  Generation:          1
  Resource Version:    7093263
  Self Link:           /apis/networking.istio.io/v1alpha3/namespaces/default/gateways/iris-gateway
  UID:                 4c4fac7d-a698-4c9c-97e6-ebc7416c96a8
Spec:
  Selector:
    Istio:  ingressgateway
  Servers:
    Hosts:
      *
    Port:
      Name:      http
      Number:    80
      Protocol:  HTTP
Events:          <none>

虚拟服务:

$ kubectl describe virtualservice apiexg
Name:         apiexg
Namespace:    default
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"networking.istio.io/v1alpha3","kind":"VirtualService","metadata":{"annotations":{},"name":"apiexg","namespace":"default"},"...
API Version:  networking.istio.io/v1alpha3
Kind:         VirtualService
Metadata:
  Creation Timestamp:  2019-08-23T19:26:16Z
  Generation:          1
  Resource Version:    7107510
  Self Link:           /apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/apiexg
  UID:                 861bca0d-be98-4bfb-bf92-b2bd2f1b703f
Spec:
  Gateways:
    iris-gateway
  Hosts:
    *
  Http:
    Match:
      Uri:
        Prefix:  /api-exchange
    Route:
      Destination:
        Host:  api-exchange.default.svc.cluster.local
        Port:
          Number:  8080
Events:            <none>

当我调用该服务时,我总是收到 503 服务不可用:

curl -X POST http://172.30.7.129:31380/api-exchange/ -vvv
* About to connect() to 172.30.7.129 port 31380 (#0)
*   Trying 172.30.7.129...
* Connected to 172.30.7.129 (172.30.7.129) port 31380 (#0)
> POST /api-exchange/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 172.30.7.129:31380
> Accept: */*
> 
< HTTP/1.1 503 Service Unavailable
< content-length: 19
< content-type: text/plain
< date: Fri, 23 Aug 2019 21:49:33 GMT
< server: istio-envoy
< 
* Connection #0 to host 172.30.7.129 left intact
no healthy upstream

这是日志输出istio-ingressgateway pod:

[2019-08-23 21:49:34.185][38][warning][upstream] [external/envoy/source/common/upstream/original_dst_cluster.cc:110] original_dst_load_balancer: No downstream connection or no original_dst.

版本:

$ istioctl version --remote
client version: 1.2.4
citadel version: 1.2.4
egressgateway version: 94746ccd404a8e056483dd02e4e478097b950da6-dirty
galley version: 1.2.4
ingressgateway version: 94746ccd404a8e056483dd02e4e478097b950da6-dirty
pilot version: 1.2.4
policy version: 1.2.4
sidecar-injector version: 1.2.4
telemetry version: 1.2.4

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.1", GitCommit:"4485c6f18cee9a5d3c3b4e523bd27972b1b53892", GitTreeState:"clean", BuildDate:"2019-07-18T09:18:22Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.0", GitCommit:"e8462b5b5dc2584fdcd18e6bcfe9f1e4d970a529", GitTreeState:"clean", BuildDate:"2019-06-19T16:32:14Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}

Istio 安装:

$ helm install /opt/istio-1.2.4/install/kubernetes/helm/istio-init --name istio-init --namespace istio-system
$ helm install /opt/istio-1.2.4/install/kubernetes/helm/istio --name istio --namespace istio-system --values istio-config/istio-config.yaml

环境:

我在使用 RHEL 7 的 Oracle Virtual Appliance 虚拟服务器和使用 RHEL 7 的 3 个物理服务器组成的集群上进行了相同的配置。


我解决这个问题。 istio-gateway 无法进行重定向,因为我的一项服务有一个ClusterIP分配:

$ kubectl get svc --all-namespaces
NAMESPACE              NAME                             TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                                                                                                                                      AGE
default                activemq                         ClusterIP      None             <none>        61616/TCP                                                                                                                                    3h17m
default                api-exchange                     ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h16m
default                api-response                     ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h16m
default                authorization-server             ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h17m
default                de-communication                 ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h16m
default                gateway                          ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h17m
default                identity                         ClusterIP      None             <none>        88/TCP,8080/TCP                                                                                                                              3h18m
default                kubernetes                       ClusterIP      10.96.0.1        <none>        443/TCP                                                                                                                                      3h19m
default                matchengine                      ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h16m
default                monitor-redis                    ClusterIP      None             <none>        8081/TCP                                                                                                                                     3h17m
default                postgres                         ClusterIP      None             <none>        5432/TCP                                                                                                                                     3h18m
default                redis                            ClusterIP      None             <none>        6379/TCP                                                                                                                                     3h18m
default                synchronization                  ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h15m
default                tx-flow                          ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h15m
default                tx-manager                       ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h15m
default                tx-scheduler                     ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h15m
default                ubc-config                       ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h16m
default                ubc-services-config              ClusterIP      None             <none>        8888/TCP                                                                                                                                     3h18m
default                user-admin                       ClusterIP      None             <none>        8080/TCP                                                                                                                                     3h17m

这是我的 YAML 之一ClusterIP: None:

apiVersion: v1
kind: Service
metadata:
  name: ubc-config
  labels:
    app: ubc-config
spec:
  clusterIP: None
  ports:
  - port: 8080
    name: ubc-config
  selector:
    app: ubc-config
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ubc-config
spec:
  selector:
    matchLabels:
      app: ubc-config
  replicas: 1
  template:
    metadata:
      labels:
        app: ubc-config
    spec:
      containers:
      - name: ubc-config
        image: ubc-config
        ports:
        - containerPort: 8080

如你看到的,Service.spec.ClusterIP被设定为NONE。为了解决这个问题,我只需将 YAML 配置更改为:

apiVersion: v1
kind: Service
metadata:
  name: ubc-config
  labels:
    app: ubc-config
spec:
  ports:
  - port: 8080
    name: http-ubcconfig
  selector:
    app: ubc-config
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: ubc-config
spec:
  selector:
    matchLabels:
      app: ubc-config
  replicas: 1
  template:
    metadata:
      labels:
        app: ubc-config
    spec:
      containers:
      - name: ubc-config
        image: ubc-config
        ports:
        - containerPort: 8080
          name: http-ubcconfig

我希望这可以帮助别人。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Kubernetes Istio 入口网关始终响应 503 的相关文章

随机推荐

  • 从服务器下载图像以显示在 CollectionView 上

    我正在开发一个用户可以出售 购买的产品应用程序 该应用程序基于集合视图 集合视图具有集合单元格 其中显示产品图像缩略图 以下代码从服务器获取产品图像 并等待下载所有图像 然后将它们显示在单元格中 以下代码有效 但用户需要等待 10 20 秒
  • 在 Woocommerce 3 中以编程方式更新产品库存

    我非常需要帮助 我正在尝试以编程方式更新 woocommerce 产品库存数量 我们通过一些 JSON 向我们提供了供应商提要 我可以从提要中读取股票 并可以正确地从帖子元中提取数据 我正在使用最新版本的 WP 和 WOO PHP 是 7
  • Android:显示一个对话框以启用 wifi

    我想 如果 wifi 被禁用 向用户显示一个对话框 可以决定他是否要启用或禁用 wifi 好吧 我可以查看 wifi 是否已启用 但我如何显示该设置对话框 这是我正在使用的代码 if wifiMan isWifiEnabled false
  • 在 spring3 控制器上返回“ModelAndView”或“String”哪个更好

    ModelAndView的返回方式 RequestMapping value list method RequestMethod GET public ModelAndView list UserAuth UserAuth user Mod
  • 是否可以在 MVC3 (C#) 中为 `[Display(Name="Something")]` 数据注释使用变量

    不知道为什么 但 MVC3 中的数据注释坚持具有常量值 我只是无法理解错误消息和显示名称等内容 我喜欢这些注释 它们非常易于使用且功能强大 但是如果您需要支持多种语言怎么办 想象一下我有以下模型 public class Person pu
  • 如何根据SSIS中的用户变量值在数据流中使用if..else

    I have a fairly straightforward SSIS package with a number of Data Flow tasks each with data flows for multiple tables l
  • 如何查看导致 clr.dll 中崩溃转储的 C# 代码?

    我有一个 Windows 窗体应用程序 NET 4 它在我的开发计算机上运行良好 但在其他两台测试计算机上崩溃 我可以加载它在 VS2010 中创建的小型转储 选择 使用混合调试 会导致 Visual Studio 明显无休止地滥用 CPU
  • CLR 如何加载 DLL?

    我的假设始终是 CLR 在应用程序域启动时加载了它所需的所有 DLL 然而 我写了一个例子 让我对这个假设提出质疑 我启动我的应用程序并检查加载了多少模块 Process ObjModulesList ProcessModuleCollec
  • 如何 Gammu 发送 php shell_exec windows 7 和 xampp?

    我已经安装了XAMPP最新版本并安装了gammu 在终端中 我可以发送短信或识别我的手机 但如果我在 php shell exec 或 exec 上尝试相同的命令 则会出现问题 命令 C Program Files gammu bin ga
  • 将 boost 序列化与犰狳 datum::nan 值结合使用

    我在我的 C CLI 程序中使用 boost 序列化 并且某些类具有包含一些 double 的数据成员 这些 double 被初始化为 arma datum nan 犰狳库的 非数字 值 我通过 boost archive text oar
  • 如何使用spring AOP切入点表达式拦截返回类型List

    以下是我的方面课程 我正在努力让所有的回报List从我的baserepostitary Aspect Service public class DecryptionAspect AfterReturning value execution
  • 重置 git 设置

    当我尝试下载时this https git01 codeplex com casablancagit repo 我不断得到error RPC failed result 56 HTTP code 200我认为这是因为我弄乱了一些设置 我正在
  • 在iOS中解析连续的JSON流

    我正在努力掌握我正在编写的应用程序的 JSON 技巧 在应用程序端 我有一个 NSInputStream 它通过 CFStreamCreatePairWithSocketToHost 连接到服务器 服务器正在以异步方式为应用程序生成 JSO
  • 如何将对象传递给 Reveal 模态弹出窗口?

    我想在我的 Rails 3 0 3 应用程序中使用 Reveal Modal jQuery 插件 我想要做的是从父对象的索引页创建子对象 现在我有链接将父级的 id 传递给子控制器的 new 方法 然后打开子级的 new html erb
  • 如何在 C# MVC 中从 Google+ 登录迁移到 Google 登录

    我的网站允许用户使用其 Google 帐户注册并登录 我的 C MVC 应用程序使用 Microsoft AspNet Identity Owin 提供的模板功能 我收到了一封来自 Google 的电子邮件 称他们将关闭 Google 该电
  • 在 Eclipse IDE 上使用 VBA [重复]

    这个问题在这里已经有答案了 可能的重复 有没有便宜或免费的 VB6 编程 IDE https stackoverflow com questions 1766514 any cheap or free ides out there for
  • 使用 shell 脚本进行 CGI 编程

    我需要将文本框的内容传递到变量中 即 在 html 页面的文本框中输入的任何内容都需要传递给变量 这是因为我在 linux shell 编程中调用 HTML 以及 CGI 我需要根据需要操纵该变量 你有什么想法去做吗 我需要做的是 我想获取
  • PushSharp 不发送通知

    我有一个简单的代码 PushBroker pushBroker new PushBroker string path HttpContext Current Server MapPath AppSettings CertificatePat
  • 以编程方式将 UITableView 行从一个位置移动/动画化到另一个位置

    我有一个 UITableView 我想以编程方式将一行从位置 N1 移动到位置 N2 并且我希望它能够从旧位置到新位置进行动画处理 我浏览了 UITableView 文档 只看到插入 重新加载和删除 您知道我可以通过编程方式执行此操作的方法
  • Kubernetes Istio 入口网关始终响应 503

    我正在使用 Helm 配置 Istio 在这里你可以找到我的istio config yaml global proxy accessLogFile dev stdout resources requests cpu 10m memory