- The Kubernetes Workshop
- Zachary Arnold Sahil Dua Wei Huang Faisal Masood Melony Qin Mohammed Abu Taleb
- 509字
- 2021-06-11 18:18:00
API Groups
An API group is a collection of resources that are logically related to each other. For example, Deployments, ReplicaSets, and DaemonSets all belong to the apps API group: apps/v1.
Note
You will learn about Deployments, ReplicaSets, and DaemonSets in detail in Chapter 7, Kubernetes Controllers. In fact, this chapter will talk about many API resources that you will encounter in later chapters.
The --api-group flag can be used to scope the output to a specific API group, as we will see in the following sections. Let's take a closer look at the various API groups in the following sections.
Core Group
This is also called the legacy group. It contains objects such as pods, services, nodes, and namespaces. The URL path for these is /api/v1, and nothing other than the version is specified in the apiVersion field. For example, consider the following screenshot where we are getting information about a pod:

Figure 4.25: API group of a pod
As you can see here, the apiVersion: v1 field indicates that this resource belongs to the core group.
Resources showing a blank entry in the kubectl api-resources command output are part of the core group. You can also specify an empty argument flag (--api-group='') to only display the core group resources, as follows:
kubectl api-resources --api-group=''
You should see an output as follows:

Figure 4.26: Listing out the resources in the core API group
Named Group
This group includes objects for whom the request URL is in the /apis/$NAME/$VERSION format. Unlike the core group, named groups contain the group name in the URL. For example, let's consider the following screenshot where we have information about a Deployment:

Figure 4.27: The API group of a Deployment
As you can see, the highlighted field showing apiVersion: apps/v1 indicates that this resource belongs to the apps API group.
You can also specify the --api-group='<NamedGroup Name>' flag to display the resources in that specified named group. For example, let's list out the resources under the apps API group by using the following command:
kubectl api-resources --api-group='apps'
This should give the following response:

Figure 4.28: Listing out the resources in the apps API group
All of these resources in the preceding screenshot are clubbed together because they are part of the apps named group, which we specified in our query command.
As another example, let's look at the rbac.authorization.k8s.io API group, which has resources to determine authorization policies. We can look at the resources in that group by using the following command:
kubectl api-resources --api-group='rbac.authorization.k8s.io'
You should see the following response:

Figure 4.29: Listing out the resources in the rbac.authorization.k8s.io API group
System-Wide
This group consists of system-wide API endpoints, such as /version, /healthz, /logs, and /metrics. For example, let's consider the output of the following command:
kubectl version --short --v=6
This should give an output similar to this:

Figure 4.30: Request URL for the kubectl version command
As you can see in this screenshot, when you run kubectl --version, this goes to the /version special entity, as seen in the GET request URL.
- 從區(qū)塊鏈到Web3:構(gòu)建未來互聯(lián)網(wǎng)生態(tài)
- Twilio Cookbook
- 物聯(lián)網(wǎng)之魂:物聯(lián)網(wǎng)協(xié)議與物聯(lián)網(wǎng)操作系統(tǒng)
- 新一代物聯(lián)網(wǎng)架構(gòu)技術(shù):分層算力網(wǎng)絡(luò)
- INSTANT KineticJS Starter
- 物聯(lián)網(wǎng)場(chǎng)景設(shè)計(jì)與開發(fā)(初級(jí))
- 基于IPv6的家居物聯(lián)網(wǎng)開發(fā)與應(yīng)用技術(shù)
- 網(wǎng)絡(luò)安全之道
- 物聯(lián)網(wǎng),So Easy!
- 5G智慧交通
- 通信系統(tǒng)實(shí)戰(zhàn)筆記:無處不在的信號(hào)處理
- LiveCode Mobile Development Beginner's Guide
- 天下一家:網(wǎng)絡(luò)聯(lián)通世界(科學(xué)新導(dǎo)向叢書)
- OpenShift Cookbook
- 物聯(lián)網(wǎng)與無線傳感器網(wǎng)絡(luò)(第2版)