Reputation: 2158
In Kubernetes we can request resources using different API versions:
kubectl get roles.v1.rbac.authorization.k8s.io foo -n bar -oyaml
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: foo
namespace: bar
rules:
- apiGroups:
- ""
resources:
- endpoints
- secrets
verbs:
- create
- get
- watch
- list
- update
kubectl get roles.v1beta1.rbac.authorization.k8s.io foo -n bar -oyaml
Warning: rbac.authorization.k8s.io/v1beta1 Role is deprecated in v1.17+, unavailable in v1.22+; use rbac.authorization.k8s.io/v1 Role
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: foo
namespace: bar
rules:
- apiGroups:
- ""
resources:
- endpoints
- secrets
verbs:
- create
- get
- watch
- list
- update
rbac.authorization.k8s.io/v1beta1
, break already created/stored resources?Upvotes: 5
Views: 2761
Reputation: 732
api_changes should answer the quesionts from Kubernetes developer's view.
Would the API version used to create a resource have an impact on the resource stored in ETCD?
No. Usually the latest stable version is stored in ETCD. Which version you use to create a resource would be transformed to latest stable version and stored in ETCD
If a resource was stored when the newer API version (v1) did not exist yet, would this be a problem when the older API version (v1beta1) is removed?
If v1beta1 is no longer supported, all v1beta1 resources should migrate to newer version before the cluster is upgraded.
Would upgrading to Kubernetes v1.22, which removes rbac.authorization.k8s.io/v1beta1, break already created/stored resources?
You need to migrate them before upgrading.
How are resource transformations between different API versions handled?
Usually there is a internal structure. Any supported API versions could transform from an to the internal structure without loss of information.
What I mean "usually" is that develpers could choose their ways to manage API versions. api_changes just give us a good practice to help with compatibility and maintainability of managing API version.
Upvotes: 0
Reputation: 8411
If a resource was stored when the newer API version (v1) did not exist yet, would this be a problem when the older API version (v1beta1) is removed?
Kubernetes supports a huge elastic deprecation system, which allows you to create, migrate and maintain API versions in time, however(jumping to your next question, you should sometimes manually upgrade API versions to up-to-date ones)
You can check Kubernetes Deprecation Policy guide, that is very important part of keeping cluster in work condition.
Main rules:
You can check also table that describes which API versions are supported in a series of subsequent releases.
Would upgrading to Kubernetes v1.22, which removes rbac.authorization.k8s.io/v1beta1, break already created/stored resources?
I think yes and you have to do some actions according to 1.22 RBAC deprecation resources
How are resource transformations between different API versions handled?
Check What to do
Upvotes: 3