0
votes

I am learning GCP and wanted to create a Kubernetes cluster with instance, here is what I did and what I followed with no success:

First set the region to my default us-east1-b:

xenonxie@cloudshell:~ (rock-perception-263016)$ gcloud config set compute/region us-east1-b
Updated property [compute/region].

Now proceed to create it:

xenonxie@cloudshell:~ (rock-perception-263016)$ gcloud container clusters create my-first-cluster --num-nodes 1

ERROR: (gcloud.container.clusters.create) One of [--zone, --region] must be supplied: Please specify location.

So it seems default region/zone us-east1-b is NOT picked up

I then run the same command again with region specified explicitly:

xenonxie@cloudshell:~ (rock-perception-263016)$ gcloud container clusters create my-first-cluster --num-nodes 1 --zone us-east1-b

WARNING: Currently VPC-native is not the default mode during cluster creation. In the future, this will become the default mode and can be disabled using --no-enable-ip-alias flag. Use --[no-]enable-ip-alias flag to suppress this warning. WARNING: Newly created clusters and node-pools will have node auto-upgrade enabled by default. This can be disabled using the --no-enable-autoupgrade flag. WARNING: Starting in 1.12, default node pools in new clusters will have their legacy Compute Engine instance metadata endpoints disabled by default. To create a cluster with legacy instance metadata endpoints disabled in the default node pool,run clusters create with the flag --metadata disable-legacy-endpoints=true. WARNING: Your Pod address range (--cluster-ipv4-cidr) can accommodate at most 1008 node(s). This will enable the autorepair feature for nodes. Please see https://cloud.google.com/kubernetes-engine/docs/node-auto-repair for more information on node autorepairs. ERROR: (gcloud.container.clusters.create) ResponseError: code=403, message=Kubernetes Engine API is not enabled for this project. Please ensure it is enabled in Google Cloud Console and try again: visit https://console.cloud.google.com/apis/api/container.googleapis.com/overview?project=rock-perception-263016 to do so.

From the warning/error it seems I need to enable Kubernetes API, and a link is provided to me already, wonderful, I then clicked the link and it took me to enable it, which I did, right after I enabled it, I was prompt to create credential before I can use the API.

Clicking into it and choosing the right API, as you can see from the screenshot, it doesn't give me a button to create the credential:

enter image description here

What is missing here?

Thank you very much.

1
Your post is very comprehensive, thank you for that. Maybe the screen is requiring you to read "What credentials do I need?". Have you associated a billing account with your project? Maybe try the recipe again from the start and capture every screen that you see in full. There may be some clue we aren't seeing here yet.Kolban
Thank you Kolban, following your suggestion, I see the create credential button hidden there, after created the credential (not sure if it is really needed in my case), I have been able to create a fresh new wordpress site in 1 minutemdivk

1 Answers

1
votes

Once the API is created, you can go ahead and create the cluster. The credentials are not used when you use gcloud since the SDK will wrap the API call and use your logged-in user credentials.

As long as the Kubernetes Engine API shows as enabled, you should be able to run the same command you used and the cluster will be created. Most of those are just warnings letting you know about default settings that you did not specify