日志抱怨 "extensions/v1beta1 Ingress is deprecated"
Logs complaining "extensions/v1beta1 Ingress is deprecated"
我正在添加一个 Ingress,如下所示:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: cheddar
spec:
rules:
- host: cheddar.213.215.191.78.nip.io
http:
paths:
- backend:
service:
name: cheddar
port:
number: 80
path: /
pathType: ImplementationSpecific
但日志抱怨:
W0205 15:14:07.482439 1 warnings.go:67] extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
time="2021-02-05T15:14:07Z" level=info msg="Updated ingress status" namespace=default ingress=cheddar
W0205 15:18:19.104225 1 warnings.go:67] networking.k8s.io/v1beta1 IngressClass is deprecated in v1.19+, unavailable in v1.22+; use networking.k8s.io/v1 IngressClassList
为什么?使用什么是正确的 yaml?
我目前使用的是 microk8s 1.20
我分析了你的问题,得出以下结论:
- Ingress 将正常工作,您看到的这些警告只是为了通知您可用的 api 版本控制。您不必为此担心。我看到了相同的警告:
@microk8s:~$ kubectl describe ing
Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
- 至于即使您使用
apiVersion: networking.k8s.io/v1
也会发生这种情况的“原因”,我发现 following explanation:
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
)
长话短说:尽管使用了正确的 apiVersion
,但弃用的仍然被视为默认的,因此会产生您遇到的警告。
我最近也看到 changes are still being made,所以我认为它仍在处理中。
我正在添加一个 Ingress,如下所示:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: cheddar
spec:
rules:
- host: cheddar.213.215.191.78.nip.io
http:
paths:
- backend:
service:
name: cheddar
port:
number: 80
path: /
pathType: ImplementationSpecific
但日志抱怨:
W0205 15:14:07.482439 1 warnings.go:67] extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
time="2021-02-05T15:14:07Z" level=info msg="Updated ingress status" namespace=default ingress=cheddar
W0205 15:18:19.104225 1 warnings.go:67] networking.k8s.io/v1beta1 IngressClass is deprecated in v1.19+, unavailable in v1.22+; use networking.k8s.io/v1 IngressClassList
为什么?使用什么是正确的 yaml? 我目前使用的是 microk8s 1.20
我分析了你的问题,得出以下结论:
- Ingress 将正常工作,您看到的这些警告只是为了通知您可用的 api 版本控制。您不必为此担心。我看到了相同的警告:
@microk8s:~$ kubectl describe ing
Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
- 至于即使您使用
apiVersion: networking.k8s.io/v1
也会发生这种情况的“原因”,我发现 following explanation:
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 thatkubectl get ingress
would read fromnetworking.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
)
长话短说:尽管使用了正确的 apiVersion
,但弃用的仍然被视为默认的,因此会产生您遇到的警告。
我最近也看到 changes are still being made,所以我认为它仍在处理中。