-1

I am planning to upgrade Kubernetes clusters from 1.21 to 1.22. I was going through the release notes and noticed ClusterRole, RoleBinding and ClusterRoleBinding should use rbac.authorization.k8s.io/v1 as rbac.authorization.k8s.io/v1beta1 is being deprecated.

Here is the output from one of my resource rolebinding/test-rw. apiversion says rbac.authorization.k8s.io/v1 but in annotations, it says rbac.authorization.k8s.io/v1beta1. Why does annotation have v1beta1 version? is it because it was initially deployed with v1beta version and later on updated to v1 version?

$ kubectl get RoleBinding/test-rw -o yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1beta1","kind":"RoleBinding","metadata":{"annotations":{},"name":"test-rw","namespace":"default"},"roleRef":{"apiGroup":"","kind":"ClusterRole","name":"admin"},"subjects":[{"apiGroup":"","kind":"Group","name":"test-rw"}]}
  creationTimestamp: "2017-08-18T11:40:22Z"
  name: test-rw
  namespace: default
  resourceVersion: "214"
  uid: f8a89do8-885f-11e9-8dd8-12afbb11be0c 
Eva
  • 515
  • 4
  • 28

1 Answers1

0

You can use the kubectl api-versions to check the available API versions.

or kubectl explain pod to check the version

In Annotation, it's last applied config but what you are seeing is API server preferred API version.

Kubectl is the client and it will show the API server preferred version or whatever you request for using that.

kubectl get RoleBinding.v1beta1 test-rw -o yaml

So API version while creating Rolebilding not get affected when you are trying to get using kubectl.

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102