Creating a cluster

This page shows you how to create a single-zone cluster with the default features enabled in Google Kubernetes Engine. To enable or configure a specific feature of GKE on the cluster, see the documentation for that feature. You can also read more about the types of clusters you can create.

After you create a cluster, you cannot change it from zonal to regional, or regional to zonal.

Before you begin

To prepare for this task, perform the following steps:

  • Ensure that you have enabled the Google Kubernetes Engine API.
  • Enable Google Kubernetes Engine API
  • Ensure that you have installed the Cloud SDK.
  • Set your default project ID:
    gcloud config set project [PROJECT_ID]
  • If you are working with zonal clusters, set your default compute zone:
    gcloud config set compute/zone [COMPUTE_ZONE]
  • If you are working with regional clusters, set your default compute region:
    gcloud config set compute/region [COMPUTE_REGION]
  • Update gcloud to the latest version:
    gcloud components update

Creating a single-zone cluster

You can create a single-zone cluster using gcloud or the Google Cloud Console.

gcloud

To create a cluster with the gcloud command-line tool, use one of the following gcloud container clusters commands.

Replace the placeholder values, such as [CLUSTER_NAME], with appropriate values.

Using a release channel:

Replace [CHANNEL] with the name of the release channel, one of stable, regular, or rapid. Clusters enrolled in the rapid channel are not supported for production workloads.

gcloud container clusters create [CLUSTER_NAME] \
    --zone [COMPUTE_ZONE] \
    --release-channel [CHANNEL]

Using the default version:

gcloud container clusters create [CLUSTER_NAME] \
    --zone [COMPUTE_ZONE]

Using a specific version:

Replace [VERSION] with a specific version.

gcloud container clusters create [CLUSTER_NAME] \
    --zone [COMPUTE_ZONE] \
    --cluster-version [VERSION]

For the full list of optional flags, refer to the gcloud container clusters create documentation.

Console

To create a single-zone cluster using Cloud Console:

  1. Visit the Google Kubernetes Engine menu in Cloud Console.

    Visit the Google Kubernetes Engine menu

  2. Click Create cluster.

  3. Choose the Standard cluster template or choose an appropriate template for your workload.

  4. Choose the version of the cluster by selecting one of the following:

    • Choose the release channel the cluster is enrolled in. Your cluster and node pools will be auto-upgraded within that channel.
    • Choose a specific GKE version. Auto-upgrade is enabled by default, and your cluster and its node pools will be auto-upgraded when its current version is selected for auto-upgrade.
    • Choose the default version. Auto-upgrade is enabled by default, and your cluster and its node pools will be auto-upgraded when its current version is selected for auto-upgrade.

    Using release channels is recommended. If you must specify a version, leaving auto-upgrade enabled is recommended.

  5. Customize the template if necessary. The following fields are required:

    • Name: The name you choose for the cluster. It must be unique within the project and the zone.
    • Location type: Whether all the nodes in the cluster are in the same zone, or can be in any zone in a given region.
    • Zone: Compute Engine compute zone in which to create the cluster, if the Location type is Zonal.
    • Region: Compute Engine compute zone in which to create the cluster, if the Location type is Regional.
    • node pool:
      • Cluster size: The number of nodes to create in the cluster. You must have available resource quota for the nodes and their resources (such as firewall routes).
      • Machine type: Compute Engine machine type to use for the instances. Each machine type is billed differently. The default machine type is n1-standard-1. For machine type pricing information, refer to the machine type price sheet.
  6. Click Create.

After you create a cluster, you need to configure kubectl before you can interact with the cluster from the command line.

What's next?

Hai trovato utile questa pagina? Facci sapere cosa ne pensi:

Invia feedback per...

Kubernetes Engine Documentation