GKE

Creating and Deploying a Google Kubernetes Engine Cluster

Introduction

In this hands-on lab, we’ll use the Cloud Shell command line from start to finish: first containerizing an app and then deploying and exposing it.

Solution

On the lab page, right-click Open GCP Console and select the option to open it in a new private browser window (this option will read differently depending on your browser — e.g., in Chrome, it says "Open Link in Incognito Window"). Then, sign in to Google Cloud Platform using the credentials provided on the lab page.

On the Welcome to your new account screen, review the text, and click Accept. In the "Welcome L.A.!" pop-up once you're signed in, check to agree to the terms of service, choose your country of residence, and click Agree and Continue.

Enable the Kubernetes Engine API

  1. From the main Google Cloud console navigation menu, choose APIs & Services > Library.

  2. Search for "Kubernetes", and enable the Kubernetes Engine API.

Clone the Repo to Access the Files

  1. Activate the Cloud Shell by clicking the icon in the top row.

  2. Clone the GitHub repository:

    git clone https://github.com/linuxacademy/content-gc-essentials
  3. Change directory:

    cd content-gc-essentials/gke-lab-01

Create the Docker Image

  1. Still in the Cloud Shell, build the Docker image:

  2. Configure the Docker command line to authenticate to Container Registry:

  3. Tag the registry image (you can replace your project ID where indicated by highlighting the code in yellow in the Cloud Shell, which will automatically add it to your clipboard):

  4. Push the image forward (substituting your project ID where indicated):

Create the Kubernetes Engine Cluster

  1. Configure the zone:

  2. Create the clusters:

  3. Get authentication credentials:

  4. Deploy the app (substituting your project ID where indicated):

Expose the Deployed Workload

  1. Expose the deployment:

  2. Check its status:

  3. When an external IP address has been generated, copy it and paste it into a new browser tab. It should result in our application.

Last updated