infuerno.github.io

Google Cloud Training: GCP Essentials

https://google.qwiklabs.com/quests/23

A Tour of Qwiklabs and the Google Cloud Platform

A GCP Project is an organizing entity for your Google Cloud resources. It often contains resources and services e.g. a pool of virtual machines, a set of databases, and a network that connects them with one another. Projects also contain settings and permissions, which specify security rules and who has access to what resources.

Creating a Virtual Machine

Activate Google Cloud Shell

Google Cloud Shell is a virtual machine that is loaded with development tools. It offers a persistent 5GB home directory and runs on the Google Cloud. Google Cloud Shell provides command-line access to your GCP resources. See: https://cloud.google.com/sdk/gcloud

Understanding Regions and Zones

A region is a specific geographical location where you can run your resources. Each region has one or more zones. Resources that live in a zone are referred to as zonal resources. Virtual machine instances and persistent disks live in a zone. To attach a persistent disk to a virtual machine instance, both resources must be in the same zone. Similarly, if you want to assign a static IP address to an instance, the instance must be in the same region as the static IP. See: https://cloud.google.com/compute/docs/regions-zones/

SSH

See: https://cloud.google.com/compute/docs/instances/connecting-to-instance

  1. Create new configuration for authentication: gcloud config configurations create qwiklabs-gcp-8fa25fcdb0d890b7
  2. Initialise configuration: gcloud init and choose 1 to reinitialize
  3. SSH using gcloud compute ssh gcelab2 --zone us-central1-c

Create a VM

Getting Started with Cloud Shell & gcloud

Kubernetes Engine: Qwik Start

The Google Kubernetes Engine (GKE) environment consists of multiple machines (specifically Google Compute Engine instances) grouped together to form a container cluster.

A cluster consists of at least one cluster master machine and multiple worker machines called nodes.

The Deployment object is used for deploying stateless applications like web servers.

The Service object define rules and load balancing for accessing your application from the Internet

Set Up Network and HTTP Load Balancers

First need to create a cluster of machines. This can be achieve using instance templates.

gcloud compute instance-groups managed create nginx-group \
         --base-instance-name nginx \
         --size 2 \
         --template nginx-template \
         --target-pool nginx-pool

Network Load Balancer

Allows load balancing based on IP protocol data e.g. address, port, protocol type. Additional options at packet level available which isn’t available for HTTP load balancing.

gcloud compute forwarding-rules create nginx-lb \
         --region us-central1 \
         --ports=80 \
         --target-pool nginx-pool

HTTP Load Balancer

Basic HTTP Load Balancer

Allows load balancing based on URL routes. Requests are always routed the the instance closest to the user.