简体   繁体   English

如何公开访问在 Amazon EKS 上的 Kubernetes 集群上运行的应用程序?

[英]How can I publicly access my application running on a Kubernetes cluster on Amazon EKS?

Kubernetes & AWS EKS newbie here. Kubernetes 和 AWS EKS 新手在这里。

I have deployed a simple Node.js web application onto a cluster on Amazon EKS.我已将一个简单的 Node.js Web 应用程序部署到 Amazon EKS 上的集群上。 When I send a GET request to the root ( / ) route, my app responds with the message: Hello from Node .当我向根 ( / ) 路由发送GET请求时,我的应用程序会响应以下消息: Hello from Node

My Deployment and Service configuration files are as follows:我的部署和服务配置文件如下:

eks-sample-deployment.yaml eks-sample-deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: eks-sample-app-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: eks-sample-app
  template:
    metadata:
      labels:
        app: eks-sample-app
    spec:
      containers:
        - name: eks-sample-app-container
          image: sundaray/node-server:v1
          ports:
            - containerPort: 8000

eks-sample-service.yaml eks-sample-service.yaml

apiVersion: v1
kind: Service
metadata:
  name: eks-sample-app-service
spec:
  type: NodePort
  ports:
    - port: 3050
      targetPort: 8000
      nodePort: 31515
  selector:
    app: eks-sample-app

After I deployed my app, I checked the container log as shown below & I get the right response: Server listening on port 8000 .部署我的应用程序后,我检查了容器日志,如下所示,我得到了正确的响应: Server listening on port 8000

在此处输入图像描述

Now, I want to access my application from my browser.现在,我想从我的浏览器访问我的应用程序。 How do I get the URL address where I can access my app?如何获取可以访问我的应用程序的 URL 地址?

What you are looking for is Ingress您正在寻找的是 Ingress

An API object that manages external access to the services in a cluster, typically HTTP.管理对集群中服务的外部访问的 API 对象,通常是 HTTP。

https://kubernetes.io/docs/concepts/services-networking/ingress/ https://aws.amazon.com/premiumsupport/knowledge-center/eks-access-kubernetes-services/ https://kubernetes.io/docs/concepts/services-networking/ingress/ https://aws.amazon.com/premiumsupport/knowledge-center/eks-access-kubernetes-services/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM