Create a cluster and deploy a workload

Learn how to get started with Google Kubernetes Engine by creating a Kubernetes cluster and deploying a workload to the cluster.

A Kubernetes cluster provides compute, storage, networking, and other services for applications, similar to a virtual data center. Apps and their associated services that are running in Kubernetes are called workloads.

To follow step-by-step guidance for this task directly in the Google Cloud console, click Guide me:

Guide me

Before you begin

Take the following steps to enable the Kubernetes Engine API:
  1. Visit the Kubernetes Engine page in the Google Cloud console.
  2. Create or select a project.
  3. Wait for the API and related services to be enabled. This can take several minutes.
  4. Make sure that billing is enabled for your Google Cloud project.

Create a cluster in GKE Autopilot mode

In Autopilot mode, Google manages your cluster configuration, including scaling, security, and other preconfigured settings. Clusters in Autopilot mode are optimized to run most production workloads and provision compute resources based on your Kubernetes manifests.

  1. In the Google Cloud console, go to the GKE Clusters page.

    Go to Clusters

  2. Click Create.

  3. Under Cluster basics, do the following:

    1. In the Name field, enter the following name:

    2. Keep the default values for the rest of the settings and click Create to start creating the cluster.

  4. When you're redirected back to the Kubernetes clusters page, click hello-world-cluster in the Name column.

    You can watch the progress of your cluster as it is being configured, deployed, and verified.

  5. Wait until you see a check mark next to the hello-world-cluster page title.

Deploy a sample app to your cluster

Deploy a sample "hello world" web app provided by Google and stored as a container in Artifact Registry.

  1. In the Google Cloud console, go to the GKE Workloads page.

    Go to Workloads

  2. Click Deploy.

  3. Leave Existing container image selected, and in Image path enter the following path:

    This simple "hello world" app is packaged into a single container, but larger apps typically consist of several related containers that can be deployed together and run as a single workload.

  4. Click Continue to move to the Configuration section.

  5. In Deployment name, enter the following name:

  6. In Kubernetes Cluster, select hello-world-cluster.

  7. Click Continue.

  8. In the Expose section, create a load balancing Kubernetes Service to direct external requests to your app:

    1. Select Expose deployment as a new service.

    2. Leave Port 1 set to 80.

    3. In Target port 1, enter 8080.

    4. Click Deploy.

    GKE automatically assigns an available external IP address to the Service.

    This Service is considered to be part of the hello-world-app workload.

  9. For Autopilot clusters, you might see an error message, such as Does not have minimum availability. This occurs because Autopilot deletes and then re-creates the nodes. Wait a few minutes, then click Refresh to update the page.

  10. Wait until the deployment completes and you see the Deployment details page.

View a live demo in your browser

  1. In the Google Cloud console, go to the Deployment details page for hello-world-app:

    1. In the Google Cloud console, go to the GKE Workloads page.

      Go to Workloads

    2. In the Name column, click the name of the workload you deployed, hello-world-app.

  2. In the Endpoints column, click the IP address, which is publicly available.

    GKE opens a new browser tab and sends a request to your app. Dismiss any secure-site warnings, and you should see Hello, world! in the new browser tab.

    If Endpoints is empty, your organization might have a policy that prevents external access.

You have successfully created a GKE cluster in Autopilot mode and deployed a sample workload.

What's next