cloud-builders: kubectl image doesn't support (GKE) regional clusters
Regional Clusters cause challenges for the kubectl image as-is:
- It’s not possible to interact with these clusters using
zone
flag (they’re referred to byregion
) - Current clusters require
kubectl beta
commands
Near-term – since it’s possible folks will create Regional Clusters and then be flummoxed that this image doesn’t work with them – perhaps flag this documentation to state “The image does not currently work with Regional Clusters”
Longer-term – the image will need to accommodate a more general ability to refer to cluster locations
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 3
- Comments: 22 (17 by maintainers)
Commits related to this issue
- Use zonal cluster Should fix this error: https://github.com/GoogleCloudPlatform/cloud-builders/issues/176 — committed to nedap/irma_api_server by stevenvegt 6 years ago
Let me make sure I have the correct understanding of what you’re asking for, before I start modifying code.
The kubectl wrapper calls
gcloud container clusters get-credentials
with the--zone
flag, but this is incompatible with Regional Clusters, in two ways:--region
flag instead, andgcloud beta container clusters get-credentials
to be able to pass the--region
flag.If that’s the case, I propose this solution: If the
CLOUDSDK_COMPUTE_REGION
env var is set, pass it togcloud beta container clusters get-credentials
with--region
. IfCLOUDSDK_COMPUTE_ZONE
is set, pass it as--zone
as normal. If both are set, usage+exit. Requisite documentation and examples.Does that work for you?
Now that Regional Clusters are in GA
CLOUDSDK_COMPUTE_ZONE
can be set to a region:@victortrac sorry sorry – your solution isn’t messy… that we’re forced to find solutions for clusters that present differently depending on whether they’re zonal or regional is what I meant.
Hey Simon,
You could create your own cloud-builder that installs the beta version of kubectl. You could start with the kubectl Dockerfile.