cyberhippo
cyberhippo

Reputation: 61

GCloud API for GKE Services & Ingress

Is there a way to query from an API the resources under Kubernetes Engine > Services & Ingress in the GCloud console ?

Upvotes: 0

Views: 196

Answers (1)

DazWilkin
DazWilkin

Reputation: 40061

It's a good question. The answer is slightly complicated.

Essentially, IIUC, you want to list the Kubernetes services and ingresses for your cluster(s). This functionality is provided by Kubernetes' API server rather than Kubernetes Engine itself.

So, you can do this various ways but, commonly (using the kubectl command-line):

kubectl get services [--namespace=${NAMESPACE}]
kubectl get ingresses [--namespace=${NAMESPACE}]

If you've deployed e.g. Kubernetes Web UI formerly Dashboard, you should be able to enumerate the services|ingresses through it too.

You may also interact directly with your clusters' API servers to make the underlying REST API call that's made by kubectl using the above commands.

For Kubernetes Engine, Cloud Console is accessing 2, distinct APIs:

  1. The Kubernetes Engine API that provisions|manages clusters and is documented here, accessible through Console and gcloud.
  2. The Kubernetes API that provisions|manages resources (e.g. Pods, Deployments, Services, Ingress etc.) that are owned by the cluster and are documented here, some (!) are accessible through Console. All are accessible directly or commonly using Kubernetes' command-line kubectl.

Upvotes: 1

Related Questions