k8s获取apiversion下面的对应可用资源
更新:HHH   时间:2023-1-7


获取api命令
[注:以下命令的url地址http://127.0.0.1/为k8s master的地址]

  1. kubectl api-versions
    输出如下:
    apps/v1beta1
    authentication.k8s.io/v1beta1
    authorization.k8s.io/v1beta1
    autoscaling/v1
    batch/v1
    certificates.k8s.io/v1alpha1
    extensions/v1beta1
    policy/v1beta1
    rbac.authorization.k8s.io/v1alpha1
    storage.k8s.io/v1beta1
    v1

2. curl http://127.0.0.1:8080/apis|grep groupVersion|cut -d: -f2|sort|uniq -c|cut -d\" -f2
输出如下:
apps/v1beta1
authentication.k8s.io/v1beta1
authorization.k8s.io/v1beta1
autoscaling/v1
batch/v1
certificates.k8s.io/v1alpha1
extensions/v1beta1
policy/v1beta1
rbac.authorization.k8s.io/v1alpha1
storage.k8s.io/v1beta1

3. curl http://127.0.0.1:8080/api/v1|grep kind|cut -d: -f2|sort|uniq -c|cut -d \" -f2
输出如下:
APIResourceList
Binding
ComponentStatus
ConfigMap
Endpoints
Event
Eviction
LimitRange
Namespace
Node
PersistentVolume
PersistentVolumeClaim
Pod
PodTemplate
ReplicationController
ResourceQuota
Scale
Secret
SecurityContextConstraints
Service
ServiceAccount

在master的url地址后面增加api信息,收集的信息如下:


简化结果如下:
[注: 标黄为常用的部分,可以看出,extensions/v1betal适用百分之九十的场景]

返回云计算教程...