在Kubernetes部署中暴露多个端口

发布于 2025-01-22 13:39:23 字数 1015 浏览 0 评论 0原文

嗨,我目前正在尝试使用Amazon EKS设置应用程序。 我有一个使用两个端口2237和2238的应用程序。

当我在本地计算机上使用以下命令在本地计算机上运行它时,两个端口似乎都可以正常工作。

docker run -p 2237:2237 -p 2238:2238

我已经将图像推到了亚马逊ECR,目前正在尝试使用部署来创建POD。

我用来创建POD的YAML文件如下。

apiVersion: apps/v1
kind: Deployment
metadata:
  name: evcloud-vertx
  namespace: evcloud
spec:
  replicas: 2
  selector:
    matchLabels:
      app: evcloud-tcp
  template:
    metadata:
      labels:
        app: evcloud-tcp
    spec:
      containers:
        - name: evcloud-tcp
          image: ecr directory
          ports:
            - containerPort: 2238
            - containerPort: 2237

结果似乎是一个和另一个的“ crashloopbackoff”。

我的猜测是,暴露两个端口时出了问题,如果有人能给我一些反馈,这将不胜感激。

我对AWS和Kubernetes都是新手,因此,任何类型的帮助都将是真诚地赞赏的。

先感谢您!

Hi I am currently trying to set up an application using Amazon EKS.
I have an application that uses two ports 2237 and 2238.

When I run it on a local machine using the following command on a local machine both ports seems to be working fine.

docker run -p 2237:2237 -p 2238:2238

I have pushed the image to Amazon ECR and am currently trying to create pods using deployment.

The yaml file that I used to create the pods are as follows.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: evcloud-vertx
  namespace: evcloud
spec:
  replicas: 2
  selector:
    matchLabels:
      app: evcloud-tcp
  template:
    metadata:
      labels:
        app: evcloud-tcp
    spec:
      containers:
        - name: evcloud-tcp
          image: ecr directory
          ports:
            - containerPort: 2238
            - containerPort: 2237

The result seems to be "Error" for one and "CrashLoopBackOff" for the other.

My guess is that something went wrong when exposing the two ports, and it would be appreciated if anyone could give me some feedback on this.
enter image description here

I am really new to both AWS and Kubernetes, so help of any sort would be sincerely appreciated.

Thank you in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

娇女薄笑 2025-01-29 13:39:23

这似乎是ARM架构的问题。
我目前正在使用M1 Mac,并且在创建Docker Image时指定平台后解决了问题

This seems to have been a problem with the arm architecture.
I am currently using an m1 Mac and the issue was resolved after specifying the platform when creating docker image

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文