Ingress-nginx 在使用 Helm 图表安装时未分配外部 IP 地址。

huangapple go评论58阅读模式
英文:

Ingress-nginx not assigned External-IP on AWS using helm chart installation

问题

我正在尝试在AWS k8s集群上使用Helm图表安装Ingress-Nginx控制器。

Helm图表.values - https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/values.yaml

我创建了一个应用程序负载均衡器并获取了IP。

修改了chart.values

service:
  enabled: true
  appProtocol: true
  annotations:
    kubernetes.io/ingress.class: alb
    alb.ingress.kubernetes.io/scheme: internet-facing
  labels: {}
  clusterIP: "XXX.XXX.XXX.XXX"
  externalIPs: []
  loadBalancerIP: "XXX.XXX.XXX.XXX"
  loadBalancerSourceRanges: []
  enableHttp: true
  enableHttps: true
  ipFamilyPolicy: "SingleStack"
  ipFamilies:
    - IPv4
  ports:
    http: 80
    https: 443
  targetPorts:
    http: http
    https: https
  type: LoadBalancer

安装了Ingress-Nginx

helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace -f values.yaml

我仍然看不到分配的External-IP。

英文:

I am trying to install ingress-nginx controller using helm chart on AWS k8s cluster.
Helm chart.values - https://github.com/kubernetes/ingress-nginx/blob/main/charts/ingress-nginx/values.yaml

I created a Application load balancer and got the IP.

Modified the chart.values

 service:
enabled: true
# -- If enabled is adding an appProtocol option for Kubernetes service. An appProtocol field replacing annotations that were
# using for setting a backend protocol. Here is an example for AWS: service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
# It allows choosing the protocol for each backend specified in the Kubernetes service.
# See the following GitHub issue for more details about the purpose: https://github.com/kubernetes/kubernetes/issues/40244
# Will be ignored for Kubernetes versions older than 1.20
##
appProtocol: true
annotations:
  kubernetes.io/ingress.class: alb 
  alb.ingress.kubernetes.io/scheme: internet-facing
  #alb.ingress.kubernetes.io/target-type: instance 

labels: {}
clusterIP: "XXX.XXX.XXX.XXX"

# -- List of IP addresses at which the controller services are available
## Ref: https://kubernetes.io/docs/user-guide/services/#external-ips
##
externalIPs: []
# -- Used by cloud providers to connect the resulting `LoadBalancer` to a pre-existing static IP according to https://kubernetes.io/docs/concepts/services-networking/service/#loadbalancer
loadBalancerIP: "XXX.XXX.XXX.XXX"
loadBalancerSourceRanges: []
enableHttp: true
enableHttps: true
ipFamilyPolicy: "SingleStack"
# -- List of IP families (e.g. IPv4, IPv6) assigned to the service. This field is usually assigned automatically
# based on cluster configuration and the ipFamilyPolicy field.
## Ref: https://kubernetes.io/docs/concepts/services-networking/dual-stack/
ipFamilies:
  - IPv4
ports:
  http: 80
  https: 443
targetPorts:
  http: http
  https: https
type: LoadBalancer

Installed ingress-nginx

helm upgrade --install ingress-nginx ingress-nginx   --repo https://kubernetes.github.io/ingress-nginx   --namespace ingress-nginx --create-namespace -f values.yaml

I still don't see External-IP assigned.

答案1

得分: 1

如果我没弄错的话,Nginx Ingress Controller会安装在集群内的一个Pod中,因此当它接收到前端流量时,根据配置将流量路由到适当的服务。

但它不会在集群外创建任何AWS云资源,您需要自行处理。
https://docs.nginx.com/nginx-ingress-controller/intro/how-nginx-ingress-controller-works/

也许可以看看AWS负载均衡控制器,使用注释将允许您在云账户中提供一个ALB或NLB负载均衡器,并提供所需的所有配置,然后路由流量到您的Kubernetes流量内部:
https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.5/

请参考这个简要教程,了解AWS负载均衡控制器,包括如何公开外部IP:
https://repost.aws/knowledge-center/eks-access-kubernetes-services

英文:

If I'm not mistaken, the Nginx Ingress Controller installs in a pod inside the cluster so when it receives front traffic, it will route to the appropiate services as per configuration.

But it will not create any AWS cloud resource outside the cluster, you have to handle that yourself.
https://docs.nginx.com/nginx-ingress-controller/intro/how-nginx-ingress-controller-works/

Maybe take a look at the AWS Loab Balancer controller, that using annotations will allow you to provision an ALB or NLB load balancer in your cloud account with all the configuration you need, to then route traffic inside your Kubernetes traffic:
https://kubernetes-sigs.github.io/aws-load-balancer-controller/v2.5/

Take a look at this brief tutorial for AWS Load Balancer controller including exposing external IP:
https://repost.aws/knowledge-center/eks-access-kubernetes-services

huangapple
  • 本文由 发表于 2023年5月28日 01:29:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76348161.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定