Kubernetes - API Versions & Resources

When I sat down to write this article, it was originally titled Top 4 things that confused me about Kubernetes. However, as I began writing it, I realized that putting all 4 of my confusing things into one article would be entirely too much information. It needed to be broken up. So, here is part one, understanding the different API Versions & API Resources of Kubernetes.

At a high level, Kubernetes resources fall under one of two different API groups. There is the core (aka legacy) group and there is also the collection of named groups.

The Core Group

This is the original group of resources. It includes popular resources like Pods, Nodes, Namespaces, Services, and more. When you access the Kubernetes REST API, you can reference a resource from the Core Group using /api/v1. Likewise, when creating resource definition YAML files, you reference a resource from the Core Group by using the field apiVersion: v1 at the top of the file.

No alt text provided for this image

The Named Groups

As Kubernetes has evolved, so has its API. Newer types of resources can be found under their own Named Groups of APIs. For example, a Deployment falls under the apps/v1 API Group. When you access the Kubernetes REST API, you can reference a resource from a Named Group by using this syntax /apis/groupName/version (notice the "s" in apis, which is different from the Core Group, which uses just api). When creating resource definition YAML files, you reference a resource from the Named Groups by using the field apiVersion: groupName/version at the top of the file.

There are many different Named Groups, and each group contains 1 or more different types of Kubernetes resources.

No alt text provided for this image

Some useful kubectl commands

kubectl api-resources

No alt text provided for this image

This command prints the supported API resources on the server.

You'll notice that this command also gives you a lot of extra information. You'll see if a resource has a shortname, so you can type "csr" instead of "CertificateSigningRequest." You'll see the API Group that each resource is attached to, whether that's the Core Group or one of the Named Groups. You'll see if each resource is tied to a Namespace or not. Finally, you'll see the exact name to use for the "kind" field in your resource definition YAML files.

kubectl api-versions

No alt text provided for this image

This command prints the supported API versions on the server, in the form of "group/version."

This shows you all of the API groups that are supported on the server. It pulls info from both the Core Group & all of the Named Groups.


#kubernetes #k8s #cka

References

要查看或添加评论,请登录

Nathan Nellans的更多文章

  • Quick Primer on the PowerShell shell

    Quick Primer on the PowerShell shell

    Microsoft defines PowerShell as being made up of three main components. First, it is a modern command shell.

    1 条评论
  • Which Azure service to use?

    Which Azure service to use?

    Azure has a ton of services to pick from. You can see the full list here: https://azure.

  • Terraform - Deploying WVD in Azure

    Terraform - Deploying WVD in Azure

    Lately, I've been playing around with Windows Virtual Desktop (WVD) in my personal sandbox. I wanted to see if I could…

    2 条评论
  • Kubernetes - kubectl & kubeconfig Files

    Kubernetes - kubectl & kubeconfig Files

    kubectl is the command-line tool that is used to interact with Kubernetes clusters. But, how does kubectl know which…

    3 条评论
  • Azure DevOps YAML Pipelines

    Azure DevOps YAML Pipelines

    Multi-Stage CI/CD YAML Pipelines are a fairly new feature in Azure DevOps. They offer some great advantages versus the…

    2 条评论
  • All about Azure Cloud Shell

    All about Azure Cloud Shell

    Azure Cloud Shell is an interactive, in-browser shell environment. It has two different shell experiences, either Bash…

    2 条评论
  • How to connect Terraform Cloud with both Azure and Azure DevOps Services

    How to connect Terraform Cloud with both Azure and Azure DevOps Services

    This article is sort of like a Part 2. You see, I wrote a previous article that discussed connecting Terraform Cloud…

    3 条评论
  • Azure Storage Options

    Azure Storage Options

    When you create a new Storage Account in Azure you will find there are a lot of different options to select from. It…

  • Overview of email security options: SPF, DKIM, and DMARC

    Overview of email security options: SPF, DKIM, and DMARC

    If you send emails from your own custom domain name then you should really think about implementing all 3 of these…

  • Active Directory Domain Services options in Azure

    Active Directory Domain Services options in Azure

    I have a long history of working with traditional Active Directory Domain Services (AD DS). I am very familiar when it…

社区洞察

其他会员也浏览了