Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which API Group in k8s

How do I determine which apiGroup any given resource belongs in?

kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  namespace: default
  name: thing
rules:
- apiGroups: ["<wtf goes here>"]
  resources: ["deployments"]
  verbs: ["get", "list"]
  resourceNames: []
like image 910
Cole Bittel Avatar asked Sep 06 '19 11:09

Cole Bittel


People also ask

How do I find my API groups in Kubernetes?

The named groups are at REST path /apis/$GROUP_NAME/$VERSION and use apiVersion: $GROUP_NAME/$VERSION (for example, apiVersion: batch/v1 ). You can find the full list of supported API groups in Kubernetes API reference.

What API does Kubernetes use?

Kubernetes v1. 25 offers beta support for publishing its APIs as OpenAPI v3; this is a beta feature that is enabled by default.

How do I check API resources in Kubernetes?

Use kubectl API-resources: We utilize the 'kubectl API-resources –o wide' command to acquire all the API resources maintained by the Kubernetes cluster. We get name, namespaced, kind, shortnames, and apiversion of the resources by executing the command as mentioned above.

What are API groups?

The Groups API is a collection of Graph API endpoints that let you read and create Facebook Group data on behalf of group members.


1 Answers

To get API resources - supported by your Kubernetes cluster:

 kubectl api-resources -o wide

example:
NAME                              SHORTNAMES   APIGROUP                       NAMESPACED   KIND                             VERBS
deployments                       deploy       apps                           true         Deployment                   [create delete deletecollection get list patch update watch]
deployments                       deploy       extensions                     true         Deployment                   [create delete deletecollection get list patch update watch]

To get API versions - supported by your Kubernetes cluster:

kubectl api-versions

You can verify f.e. deployment:

kubectl explain deploy 

KIND:     Deployment
VERSION:  extensions/v1beta1

DESCRIPTION:
     DEPRECATED - This group version of Deployment is deprecated by
     apps/v1beta2/Deployment.

Furthermore you can investigate with api-version:

kubectl explain deploy --api-version apps/v1

Shortly you an specify in you apiGroups like:

apiGroups: ["extensions", "apps"]

You can also configure those settings for your cluster using (for example to test it will work with next 1.16 release) by passing options into --runtime-config in kube-apiserver.

Additional resources:

  • api Resources:
  • Kubernetes Deprecation Policy
  • Additional Notable Feature Updates for specific release please follow like:

    Continued deprecation of extensions/v1beta1, apps/v1beta1, and apps/v1beta2 APIs; these extensions will be retired in 1.16!

like image 88
Mark Avatar answered Sep 16 '22 22:09

Mark