【问题标题】:Ambassador Edge Stack : Working with sample project but not with my project大使边缘堆栈:使用示例项目,但不使用我的项目
【发布时间】:2020-11-18 22:29:38
【问题描述】:

我正在尝试在本地 kubernates 集群中将 Ambassador 配置为 API 网关。

安装:

  1. https://www.getambassador.io/docs/latest/tutorials/getting-started/ Windows 和 Kubernetes 部分安装
  2. 可以使用>edgectl login --namespace=ambassador localhost 登录并查看仪表板
  3. 使用他们从https://www.getambassador.io/docs/latest/tutorials/quickstart-demo/ 提供的示例项目进行配置

这是用于部署演示应用程序的YML 文件

apiVersion: apps/v1
kind: Deployment
metadata:
  name: quote
  namespace: ambassador
spec:
  replicas: 1
  selector:
    matchLabels:
      app: quote
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: quote
    spec:
      containers:
      - name: backend
        image: docker.io/datawire/quote:0.4.1
        ports:
        - name: http
          containerPort: 8080

一切都按预期工作。现在我正在尝试配置我的项目。但它不起作用。

因此,对于更简单的情况,将每个配置保留为 Ambassador 的演示,我只需将 image: docker.io/datawire/quote:0.4.1 修改为 image: angularapp:latest,其中这是 Angular 10 项目的 docker 映像。

但我收到upstream connect error or disconnect/reset before headers. reset reason: connection failure

我花了一天时间解决这个问题。我从 docker 桌面应用程序恢复了我的 Kubernetes 并重新配置,但没有运气。

【问题讨论】:

    标签: api-gateway angular10 ambassador


    【解决方案1】:

    当映射有效但由于某种原因无法访问它所指向的服务时会发生该错误。部署是否实际运行 (kubectl get deploy -A -o wide)?你的 Angular 应用程序是否暴露了 8080 端口? 8080 是一个非常常见的 kubernetes 端口,但在前端开发世界中并不多。如果您使用kubectl exec -it {{AMBASSADOR_POD}} -- shcurl http://quote 会返回预期的输出吗?

    【讨论】:

    • 其实是端口问题。我制作了 containerPort 80,现在可以正常工作了。谢谢。
    猜你喜欢
    • 2021-01-04
    • 2017-06-16
    • 2018-03-17
    • 2021-03-05
    • 1970-01-01
    • 2022-01-25
    • 2012-09-08
    • 2023-03-06
    • 1970-01-01
    相关资源
    最近更新 更多