Apigroup cannot be get from kubectl api-resources

Hi all,

As we know, the apiGroup should be specified when creating the role. And I have tried to use “kubectl api-resources” to get it. But I found that the apiGroup was not shown in k8s 1.20(please check the screen cap below). How can I get the correct apiGroup for creating role?

For example, when I’m creating a role to list deployments for a user, the apiGroup I got from command “kubectl api-resources | grep deploy” is “apps/v1” and it is failed. And I have googled it and reset the apiGroup to “apps” and “extensions” to make it work.

Thank you.

Hello hlngai,

you should set apiGroups: [“apps”] instead of apiGroups: [“apps/v1”].
check the following link for creating roles

Thanks
KodeKloud Support