Kubectl api-resources lists duplicate resources with different API groups

9/23/2019

I have run a simple command:

kubectl api-resources

I was a bit surprised to get duplicates (albeit in different Api groups), e.g.:

NAME                              SHORTNAMES   APIGROUP                NAMESPACED   KIND 
ingresses                         ing          extensions              true         Ingress
ingresses                         ing          networking.k8s.io       true         Ingress

Is it the same resource, just listed twice because it belongs to different api groups at the same time and the result of the following calls are always the same?

kubectl get ingress
kubectl get ingress.networking.k8s.io
kubectl get ingress.extensions
-- Ilya Chernomordik
kubectl
kubernetes

1 Answer

9/23/2019

These are actually different versions of the same resource in different API groups.

In general, when new resource types are introduced to Kubernetes, they are first managed in the extensions API group (iterating through multiple versions). Once the resources are regarded stable, they are moved to a "stable" API group, such as apps or networking.k8s.io (explained, for example, here).

The fact that Ingress is listed in both API groups means that your API server can understand versions of this resource from both API groups.

The specifications of the specific resource versions may differ. You can compare them, for example, with:

kubectl explain --api-version=extensions/v1beta1 ingress

vs.

kubectl explain --api-version=networking.k8s.io/v1beta1 ingress

In-depth explanations of how the API server handles different versions of a resource can be found in this article series.

-- weibeld
Source: StackOverflow