Skip to content

Instantly share code, notes, and snippets.

@mik-laj
Last active June 19, 2023 20:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mik-laj/63782fce754b9c64c6f6d1ad14fa00a4 to your computer and use it in GitHub Desktop.
Save mik-laj/63782fce754b9c64c6f6d1ad14fa00a4 to your computer and use it in GitHub Desktop.
API Request to GKE cluster using curl
GCP_CLUSTER_NAME=europe-west1-fluffy-bcad8335-gke
GCP_CLUSTER_ZONE=europe-west1-b
curl --cacert <(gcloud container clusters describe "${GCP_CLUSTER_NAME}" \
--zone "${GCP_CLUSTER_ZONE}" \
--format='value(masterAuth.clusterCaCertificate)' | base64 -d\
) \
--header "Authorization: Bearer $(gcloud auth print-access-token)" \
https://$(gcloud container clusters describe "${GCP_CLUSTER_NAME}" \
--zone "${GCP_CLUSTER_ZONE}" \
--format='value(endpoint)'\
)/logs/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment