Why am I getting "(gcloud.alpha.container.clusters.create) ResponseError: code=404, message=Method not found." during alpha cluster creation?

11/29/2019

I'm creating a Kubernetes Alpha cluster with --enable-pod-security-policy which is only available when using gcloud alpha instead of gcloud afaik. I'm using

$ gcloud alpha container clusters create cluster-name --machine-type=n1-standard-1 --no-enable-stackdriver-kubernetes --no-enable-autoupgrade --preemptible --enable-kubernetes-alpha --quiet --enable-pod-security-policy

which fails due to

61 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.
62 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`.
63 WARNING: Your Pod address range (`--cluster-ipv4-cidr`) can accommodate at most 1008 node(s). 
64 ERROR: (gcloud.alpha.container.clusters.create) ResponseError: code=404, message=Method not found.

When using gcloud instead of gcloud alpha for the above command without --enable-pod-security-policy the cluster is created. I'm not sure and I think no one can tell from the application feedback where the error is.

-- Karl Richter
gcloud
google-cloud-platform
kubernetes

1 Answer

11/29/2019

As per the Cloud SDK release notes, the --enable-pod-security-policy flag was added in version 191.0.0.

You should ensure you have an up-to-date Cloud SDK installation by running:

$ gcloud components update

and run your command with beta keyword:

$ gcloud beta container clusters create cluster-name --machine-type=n1-standard-1 --no-enable-stackdriver-kubernetes --no-enable-autoupgrade --preemptible --enable-kubernetes-alpha --quiet --enable-pod-security-policy
-- LundinCast
Source: StackOverflow