k8s of api


一、namespaced resources

The so-called namespaced resources, is this resource that belongs to a namespace, such as pod, deployment, service belong namespaced resource.
http://localhost:8080/api/v1/namespaces/default/pods/test-pod
 
As can be seen, the organization is restful api:
namespace types of resources api api version namespaces belongs to the requested resource name
api v1 namespaces default pods test-pod
 
二、non-namespaced resources
http://localhost:8080/apis/rbac.authorization.k8s.io/v1/clusterroles/test-clusterrole
Here it can be observed that the pod clusterrole different, apis that this is a non-core api. Rbac.authorization.k8s.io refer to the api-group, while it does not namespaces field, similar to the namespaced resources. Omitted.
 
三, non-resource URL
Such resources and pod, clusterrole are different. For example
http://localhost:8080/healthz/etcd
This is used to confirm etcd service is not healthy. It does not belong to any namespace, it does not belong to any api version.
 
Summary, the design of the structure k8s REST API is:
[api/apis]/api-group/api-version/namespaces/namespace-name/resource-kind/resource-name
apis/rbac.authorization.k8s.io/v1/namespaces/default/roles/test-role
 
 

Guess you like

Origin www.cnblogs.com/muzinan110/p/11105788.html