Kubernetes Service API

Summary: Author: 张亚飞 | Read Time: 1 minute read | Published: 2018-06-11
Filed under Categories: KubernetesTags: Kubernetes, Cilium,

Kubernetes Service API

除了可以通过 kubelet 访问 k8s 集群资源,也可以通过 kubernetes 提供的 service api 访问集群资源:

访问方式

使用证书

使用Token

使用proxy

推荐,不用鉴权,可以直接通过浏览器访问 service api 资源

kubectl proxy --port 8080

查看集群所有 api

curl http://localhost:8080
curl http://localhost:8080/api/v1/proxy/namespaces/YOURNAMESPACE/services/YOURSERVICE:PORT

例如查看集群所有pod

curl http://localhost:8080/api/v1/pods

查看指定命名空间下的所有pod:

curl http://localhost:8080/api/v1/namespaces/bdata/pods

使用curl访问k8s的apiserver

Comments

Cor-Ethan, the beverage → www.iirii.com