gpt4 book ai didi

kubernetes - 如何在 EKS 中通过 api networking.k8s.io/v1 使用 ALB Ingress

转载 作者:行者123 更新时间:2023-12-04 17:20:39 25 4
gpt4 key购买 nike

之前我使用 extensions/v1beta1 api 在 Amazon EKS 上创建 ALB。将 EKS 升级到 v1.19 后,我开始收到警告:

Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress

所以我开始相应地更新我的入口配置并部署了 ALB,但是 ALB 没有在 AWS 中启动,也没有获得 ALB 地址。

入口配置-->

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: "pub-dev-alb"
namespace: "dev-env"
annotations:
kubernetes.io/ingress.class: "alb"
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip

spec:
rules:
- host: "dev.test.net"
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: "dev-test-tg"
port:
number: 80

节点端口配置-->

apiVersion: v1
kind: Service
metadata:
name: "dev-test-tg"
namespace: "dev-env"
spec:
ports:
- port: 80
targetPort: 3001
protocol: TCP
type: NodePort
selector:
app: "dev-test-server"

结果--->

enter image description here

二手 this documentation创建 ALB 入口 Controller 。

有人能帮我吗?

最佳答案

即使您使用最新的 Ingress,您的 Ingress 也应该可以正常工作。您看到的警告表明有新版本的 API 可用。您不必担心。

这是 explanation为什么会出现此警告,即使您使用 apiVersion: networking.k8s.io/v1:

This is working as expected. When you create an ingress object, it can be read via any version (the server handles converting into the requested version). kubectl get ingress is an ambiguous request, since it does not indicate what version is desired to be read.

When an ambiguous request is made, kubectl searches the discovery docs returned by the server to find the first group/version that contains the specified resource.

For compatibility reasons, extensions/v1beta1 has historically been preferred over all other api versions. Now that ingress is the only resource remaining in that group, and is deprecated and has a GA replacement, 1.20 will drop it in priority so that kubectl get ingress would read from networking.k8s.io/v1, but a 1.19 server will still follow the historical priority.

If you want to read a specific version, you can qualify the get request (like kubectl get ingresses.v1.networking.k8s.io ...) or can pass in a manifest file to request the same version specified in the file (kubectl get -f ing.yaml -o yaml)

您还可以看到 similar question .

关于kubernetes - 如何在 EKS 中通过 api networking.k8s.io/v1 使用 ALB Ingress,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66370030/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com