kubernetes API概述·
  1D6o7E39IQo1 2023年11月02日 16 0
API 对象组成部分
Group + version + resource  三个部分组成
常见API(一)
/api/
--------
"/api"
"/api/v1"
常见API(二)
/apis/
--------
 "/apis/",
 "/apis/admissionregistration.k8s.io",
 "/apis/admissionregistration.k8s.io/v1",
 "/apis/apiextensions.k8s.io",
 "/apis/apiextensions.k8s.io/v1",
 "/apis/apiregistration.k8s.io",
 "/apis/apiregistration.k8s.io/v1",
 "/apis/apps",
 "/apis/apps/v1",
 "/apis/authentication.k8s.io",
 "/apis/authentication.k8s.io/v1",
 "/apis/authorization.k8s.io",
 "/apis/authorization.k8s.io/v1",
 "/apis/autoscaling",
 "/apis/autoscaling/v1",
 "/apis/autoscaling/v2",
 "/apis/autoscaling/v2beta2",
 "/apis/batch",
 "/apis/batch/v1",
常见API(三)
/healthz/
--------
"/healthz/autoregister-completion",
"/healthz/etcd",
"/healthz/log",
"/healthz/ping",
"/healthz/poststarthook/aggregator-reload-proxy-client-cert",
"/healthz/poststarthook/apiservice-openapi-controller",
"/healthz/poststarthook/apiservice-openapiv3-controller",
"/healthz/poststarthook/apiservice-registration-controller",
"/healthz/poststarthook/apiservice-status-available-controller",
"/healthz/poststarthook/bootstrap-controller",
"/healthz/poststarthook/crd-informer-synced",
"/healthz/poststarthook/generic-apiserver-start-informers",
"/healthz/poststarthook/kube-apiserver-autoregistration",
"/healthz/poststarthook/priority-and-fairness-config-consumer",
"/healthz/poststarthook/priority-and-fairness-config-producer",
"/healthz/poststarthook/priority-and-fairness-filter",
常见API(四)
/metrics/
常见API(五)
/openapi/v2
Resources 和 kind
Resources: HTTP Restful API请求路径中的资源; Restful API的资源; resources 是小写复数指代(pods)
kind: 系统中真正的实体

例如: /api/v1/namespace/$namespace/pods

kubernetes API概述·_API

kubernetes API概述·_GVR_02

GVR 和 GVK
GVR: GroupVersionResource: GVK和GVR相关联,GVK通过GVR的HTTP路径提供服务,将GVK映射到GVR的过程
     称为Rest mapping

GVK: GroupVersionKind : 每个kind 都存在一个group 和 version, 通过GVK标识
查看API 对象指令
[root@k8smaster4 cm]# kubectl get --raw /
{
  "paths": [
    "/.well-known/openid-configuration",
    "/api",
    "/api/v1",
    "/apis",
    "/apis/",
    "/apis/admissionregistration.k8s.io",
    "/apis/admissionregistration.k8s.io/v1",
    "/apis/apiextensions.k8s.io",
    "/apis/apiextensions.k8s.io/v1",
    "/apis/apiregistration.k8s.io",
    "/apis/apiregistration.k8s.io/v1",
    "/apis/apps",
    "/apis/apps/v1",
    "/apis/authentication.k8s.io",
    "/apis/authentication.k8s.io/v1",
查看某一API资源指令
[root@k8smaster4 cm]# kubectl get --raw /api/v1 | python -m json.tool
{
    "groupVersion": "v1",
    "kind": "APIResourceList",
    "resources": [
        {
            "kind": "Binding",
            "name": "bindings",
            "namespaced": true,
            "singularName": "",
            "verbs": [
                "create"
            ]
        },
        {
            "kind": "ComponentStatus",
            "name": "componentstatuses",
            "namespaced": false,
            "shortNames": [
                "cs"
            ],
            "singularName": "",
            "verbs": [
                "get",
                "list"
            ]
        },
        {
            "kind": "ConfigMap",
            "name": "configmaps",
            "namespaced": true,
            "shortNames": [
                "cm"
            ],
            "singularName": "",
            "storageVersionHash": "qFsyl6wFWjQ=",
            "verbs": [
                "create",
                "delete",
                "deletecollection",
                "get",
                "list",
                "patch",
                "update",
                "watch"
            ]
        },

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

1D6o7E39IQo1
作者其他文章 更多

2023-11-13

2023-11-13

2023-11-13

2023-11-13

2023-11-13

2023-11-13

2023-11-13

2023-11-13