i am trying to create kubernetes cluster in GCP but i am unable to create and getting following error "Google Compute Engine: Required 'compute.machineTypes.get' permission for 'projects/PROJECT_ID/zones/us-central1-a/machineTypes/e2-medium'". And also getting zonal error as follows "Google Compute Engine: Required 'compute.zones.get' permission for 'projects/PROJECT_ID/zones/us-central1-a'".
0
votes
what is the out put of this command - 'gcloud auth list' and also roles assigned to this service account?
– Mahboob
'gcloud auth list' this command gives me my account mail id
– sai manikanta
It seems, you don't have enough privileges to create kubernetes cluster. Please ask your organistation to grant you kubernetes admin privileges to spin up new cluster.
– user10780072
Thanks for your information. I have added a role "kubernetes Engine admin " to my account and it is working now.
– sai manikanta
2 Answers
1
votes
From the error I understand that it is permission issue.
In order to create a kubernetes cluster create a service account and assigned the editor role the it. Now, activate the service account in gcloud shell. Using the following command create a cluster:
gcloud container clusters create sample-cluster
If still problem persist, you need to grant the following permission to the service account.
roles/compute.instanceAdmin
roles/iam.serviceAccountUser