Awwvision: Cloud Vision API from a Kubernetes Cluster | Qwiklabs

abhinavcreed13/gcp-cloud-skills-badges

The Awwvision lab uses Kubernetes and Cloud Vision API to demonstrate how to use the Vision API to classify (label) images from Reddit's /r/aww subreddit and display the labelled results in a web app.

Awwvision has three components:

  1. A simple Redis instance.
  2. A web app that displays the labels and associated images.
  3. A worker that handles scraping Reddit for images and classifying them using the Vision API. Cloud Pub/Sub is used to coordinate tasks between multiple worker instances.

Create a Kubernetes Engine cluster

In this lab you will use gcloud, Google Cloud's command-line tool, to set up a Kubernetes Engine cluster. You can specify as many nodes as you want, but you need at least one. The cloud platform scope is used to allow access to the Pub/Sub and Vision APIs.

In Cloud Shell, run the following to create a cluster in the us-central1-a zone:

gcloud config set compute/zone us-central1-a

Then start up the cluster by running:

gcloud container clusters create awwvision \\
    --num-nodes 2 \\
    --scopes cloud-platform

Run the following to use the container's credentials:

gcloud container clusters get-credentials awwvision

Verify that everything is working using the kubectl command-line tool:

kubectl cluster-info