简体   繁体   English

将Nginx入口绑定到静态IP地址

[英]Bind nginx-ingress to static IP Address

I want to set up an ingress controller on AWS EKS for several microservices that are accessed from an external system. 我想在AWS EKS上为从外部系统访问的多个微服务设置一个入口控制器。

The microservices are accessed via virtual host-names like svc1.acme.com , svc2.acme.com , ... 通过虚拟主机名(例如svc1.acme.comsvc2.acme.com ,...)访问微服务。

I set up the nginx ingress controller with a helm chart: https://github.com/helm/charts/tree/master/stable/nginx-ingress 我用头盔图设置了Nginx入口控制器: https : //github.com/helm/charts/tree/master/stable/nginx-ingress

My idea was to reserve an Elastic IP Address and bind the nginx-controller to that IP by setting the variable externalIP. 我的想法是保留一个弹性IP地址,并通过设置变量externalIP将nginx-controller绑定到该IP。

This way I should be able to access the services with a stable wildcard DNS entry *.acme.com --> 54.72.43.19 这样,我应该能够使用稳定的通配符DNS条目*.acme.com --> 54.72.43.19访问服务

I can see that the ingress controller service get the externalIP, but the IP is not accessible. 我可以看到入口控制器服务获得了externalIP,但是该IP无法访问。

NAME                                    TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE
ingress-nginx-ingress-controller        LoadBalancer   10.100.45.119    54.72.43.19   80:32104/TCP,443:31771/TCP   1m

Any idea why? 知道为什么吗?

Update: 更新:

I installed the ingress controller with this command: 我使用以下命令安装了入口控制器:

helm install --name ingress -f values.yaml stable/nginx-ingress

Here is the gist for values, the only thing changed from the default is 这是值的要点,与默认值相比唯一更改的是

externalIPs: ["54.72.43.19"]

https://gist.github.com/christianwoehrle/3b136023b1e0085b028a67ca6a0959b7 https://gist.github.com/christianwoehrle/3b136023b1e0085b028a67ca6a0959b7

Maybe you can achieve that by using a Network Load Balancer ( https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html ), that supports fixed IPs, as the backing for your Nginx ingress, eg ( https://aws.amazon.com/blogs/opensource/network-load-balancer-support-in-kubernetes-1-9/ ): 也许您可以通过使用支持固定IP的网络负载平衡器( https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html )来实现,以作为Nginx入口的支持,例如( https://aws.amazon.com/blogs/opensource/network-load-balancer-support-in-kubernetes-1-9/ ):

apiVersion: v1
kind: Service
metadata:
  name: nginx
  namespace: default
  labels:
    app: nginx
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
spec:
  externalTrafficPolicy: Local
  ports:
  - name: http
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: nginx
type: LoadBalancer

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

相关问题 Kubernetes nginx-ingress 没有暴露服务 - Kubernetes nginx-ingress isnt exposing the services nginx 入口 controller 类型 nlb 与 static Z957B527BCFBAD2E80F58D2068ZNotFound 错误“AllocationIdFound”14358D2068ZNotFound 错误 - nginx ingress controller type nlb with static ip giving error "AllocationIdNotFound" 如何使用 nginx-ingress controller 公开 TCP 的多个服务? - How to expose multiple services with TCP using nginx-ingress controller? Nginx 400,一个简单的 http 响应被发送到带有 nginx-ingress controller 的 HTTPS 端口 - Nginx 400, A plain http response was sent to HTTPS port with nginx-ingress controller Kops nginx-Ingress controller 由于权限问题无法创建 AWS 网络负载均衡器 - Kops nginx-Ingress controller fails to create AWS Network Load Balancer due to permission issue 如何使用 helm-chart 为 nginx-ingress 设置 AWS ELB 名称 - How to set AWS ELB name for nginx-ingress using the helm-chart AWS静态IP地址 - AWS static ip address 静态 IP 地址 - Static IP Address AWS - x-real-ip 是 nginx-ingress-controller 的 ip - AWS - x-real-ip is ip of nginx-ingress-controller 使用aws-load-balancer-backend-protocol时,nginx-ingress无法与AWS ELB一起使用:“ https” - nginx-ingress doesn't work with AWS ELB when use aws-load-balancer-backend-protocol: “https”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM