Answer By Deepseek
The error you're encountering indicates that the specified network (default) does not exist in your Google Cloud project. To fix this issue, you can either create the default network or specify an existing network when creating the Kubernetes cluster.
Here are the steps to resolve the issue:
Option 1: Create the default network
If you want to use the default network, you can recreate it by running the following command:
gcloud compute networks create default --subnet-mode=autoThis will recreate the default network with automatic subnet creation. After creating the network, retry creating the Kubernetes cluster.
Option 2: Specify an existing network
If you already have a custom network in your project, you can specify it when creating the cluster. For example:
gcloud container clusters create [CLUSTER_NAME] \
--network=[EXISTING_NETWORK_NAME] \
--subnetwork=[EXISTING_SUBNETWORK_NAME] \
--zone=[ZONE]Replace the placeholders:
[CLUSTER_NAME]: The name of your Kubernetes cluster.[EXISTING_NETWORK_NAME]: The name of your existing network.[EXISTING_SUBNETWORK_NAME]: The name of your existing subnetwork (if applicable).[ZONE]: The zone where the cluster will be created.
Option 3: Use an automatically created network
If you don't specify a network, Google Kubernetes Engine (GKE) will automatically create one for you. You can simply omit the --network flag:
gcloud container clusters create [CLUSTER_NAME] --zone=[ZONE]Verify the network exists
To check the available networks in your project, run:
gcloud compute networks listThis will display all the networks in your project. Ensure the network you want to use is listed.
Additional Notes
- If you deleted the
defaultnetwork, it’s generally recommended to use a custom network for better control and organization. - Ensure that the network and subnetwork you specify have the necessary firewall rules and configurations for your cluster to function properly.
After applying one of the solutions above, retry creating the Kubernetes cluster. Let me know if you encounter further issues!