Failures during Google Kubernetes Engine (GKE) cluster creation can prevent you from
provisioning necessary infrastructure. Common causes for failures are violations
of the `constraints/compute.vmExternalIpAccess` or
`constraints/compute.restrictVpcPeering` organization policies. Use this page
to help you troubleshoot and resolve cluster creation failures caused by these
organization policies.

This information is important for Platform admins and operators or other users
responsible for creating and managing GKE clusters within a
Google Cloud organization. For more
information about the common roles and example tasks that we reference in
Google Cloud content, see [Common GKE user roles and
tasks](https://docs.cloud.google.com/kubernetes-engine/enterprise/docs/concepts/roles-tasks).

For general issues with a Kubernetes cluster, see
[Troubleshooting Clusters](https://kubernetes.io/docs/tasks/debug/debug-cluster/)
in the Kubernetes documentation.

## Error: Constraint constraints/compute.vmExternalIpAccess violated

An error similar to the following can occur when you try to create a public
GKE cluster:

    Constraint constraints/compute.vmExternalIpAccess violated for project

This only affects public GKE clusters, including
GKE Autopilot clusters.

When you create public GKE clusters, the underlying
Compute Engine VMs, which make up the worker nodes of this cluster, have
[external IP addresses](https://docs.cloud.google.com/compute/docs/ip-addresses.md.txt#externaladdresses) assigned.
If you configure the organization policy constraint
[`constraints/compute.vmExternalIpAccess`](https://docs.cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints)
to `Deny All` or to restrict external IP addresses to specific VM instances at
the organization, folder, or project level, then the
policy prevents the GKE worker nodes from obtaining external IP
addresses, which results in cluster creation failure.

To find the logs of the cluster creation operation, you can review the
[GKE Cluster Operations Audit Logs](https://docs.cloud.google.com/kubernetes-engine/docs/how-to/audit-logging.md.txt) using
[Logs Explorer](https://docs.cloud.google.com/logging/docs/view/logs-explorer-interface.md.txt) with a search
query similar to the following:

```sql
resource.type="gke_cluster"
logName="projects/test-last-gke-sa/logs/cloudaudit.googleapis.com%2Factivity"
protoPayload.methodName="google.container.v1beta1.ClusterManager.CreateCluster"
resource.labels.cluster_name="CLUSTER_NAME"
resource.labels.project_id="PROJECT_ID"
```

Replace the following:

- <var translate="no">`CLUSTER_NAME`</var>: the name of the cluster that wasn't created.
- <var translate="no">`PROJECT_ID`</var>: your project ID.

To resolve this issue, ensure that the effective policy for the constraint
`constraints/compute.vmExternalIpAccess` is `Allow All` on the project where you
are trying to create a GKE public cluster. For information on
working with this constraint, see
[Restricting external IP addresses to specific VM instances](https://docs.cloud.google.com/compute/docs/ip-addresses/configure-static-external-ip-address.md.txt#disableexternalip).

After setting the constraint to `Allow All`, delete the failed cluster and
create a new cluster. This is required because repairing the failed cluster is
not possible.

## Error: Constraint constraints/compute.restrictVpcPeering violated

An error similar to the following can occur when you try to create a private
GKE cluster that uses VPC Network Peering to connect your
VPC network to the Google-managed control plane project:

    Constraint constraints/compute.restrictVpcPeering violated for project

If you configure the
[`constraints/compute.restrictVpcPeering`](https://docs.cloud.google.com/organization-policy/reference/org-policy-constraints.md.txt#constraints/compute.restrictVpcPeering)
organization policy constraint on the organization, folder, or project that
owns the cluster's VPC network, the policy blocks
GKE from peering the control plane VPC network
with your VPC network unless the Google-managed producer
hierarchy is allowed.

To resolve this issue, use one of the following options:

- Create a cluster that uses [Private Service Connect](https://docs.cloud.google.com/kubernetes-engine/docs/concepts/private-service-connect.md.txt) for control plane connectivity instead of VPC Network Peering.
- Update the `constraints/compute.restrictVpcPeering` policy on the project, folder, or organization that owns the cluster's VPC network to add the Google service producer organization (`under:organizations/433637338589`) to the `allowedValues` field.

After updating the organization policy, delete the failed cluster and create a
new cluster.

## What's next

- If you can't find a solution to your problem in the documentation, see
  [Get support](https://docs.cloud.google.com/kubernetes-engine/docs/getting-support.md.txt) for further help,
  including advice on the following topics:

  - Opening a support case by contacting [Cloud Customer Care](https://cloud.google.com/support-hub).
  - Getting support from the community by [asking questions on StackOverflow](http://stackoverflow.com/questions/tagged/google-kubernetes-engine) and using the `google-kubernetes-engine` tag to search for similar issues. You can also join the [`#kubernetes-engine` Slack channel](https://googlecloud-community.slack.com/messages/C0B9GKTKJ/) for more community support.
  - Opening issues or feature requests by using the [public issue tracker](https://docs.cloud.google.com/support/docs/issue-trackers.md.txt).