0
点赞
收藏
分享

微信扫一扫

kubernetes API概述·

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概述·_API_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"
            ]
        },

举报

相关推荐

0 条评论