Skip to content

Latest commit

 

History

History
134 lines (108 loc) · 5.6 KB

004.md

File metadata and controls

134 lines (108 loc) · 5.6 KB

Day 4 — Google Kubernetes Engine

Agenda

  1. https://www.safaribooksonline.com/library/view/kubernetes-fundamentals/9781492032144/
  2. Kubernetes Engine Quickstart
  3. Setting up Kubernetes on Google Cloud Platform
  4. Upgrading Kubernetes cluster to the most recent version
  • Upgrade Available link in Kubernetes clusters panel

TODO

  1. https://cloud.google.com/kubernetes-engine/docs/quickstart#deploying_an_application_to_the_cluster
  2. https://cloud.google.com/sdk/gcloud/
  3. https://cloud.google.com/shell/docs/
  4. Google Kubernetes Engine Documentation
  5. https://console.cloud.google.com/
  6. Execute the Basic Commands (Beginner) of kubectl
  7. https://www.reddit.com/r/kubernetes/
  8. https://stackoverflow.com/questions/tagged/kubernetes?sort=votes&pageSize=50&mixed=1
  9. https://github.com/GoogleCloudPlatform/freshpod

Notes

Kubernetes Engine Quickstart

Kubernetes Engine Quickstart

  • Google Cloud Shell is a shell environment for managing resources hosted on Google Cloud Platform (GCP)
  • Cloud Shell comes preinstalled with the gcloud and kubectl command-line tools.
  • gcloud provides the primary command-line interface for GCP, and kubectl provides the command-line interface for running commands against Kubernetes clusters.

Google Cloud SDK

  • gcloud config list
  • gcloud config get-value project
  • gcloud config set project
  • gcloud compute zones list
  • gcloud config set compute/zone europe-west3-a

Creating a Kubernetes Engine cluster using gcloud

  • A cluster consists of at least one cluster master machine and multiple worker machines called nodes. Nodes are Compute Engine virtual machine (VM) instances that run the Kubernetes processes necessary to make them part of the cluster. You deploy applications to clusters, and the applications run on the nodes.
  • Enable Google Kubernetes Engine API
  • gcloud container clusters create hello-k8s
    • Automatically configures kubectl to use the cluster
  • gcloud container clusters list
  • kubectl get nodes
  • gcloud container clusters upgrade
  • gcloud container clusters resize hello-k8s --size=0

Install Google Cloud SDK

Install the Google Cloud SDK (with gcloud command-line tool)

$ python -V
Python 2.7.10

$ brew cask install google-cloud-sdk
...
==> Running installer script 'google-cloud-sdk/install.sh'
==> Welcome to the Google Cloud SDK!
==>
==>
==> Your current Cloud SDK version is: 188.0.1
==> Installing components from version: 188.0.1
==>
==> +----------------------------------------------------------------------------+
==> |                    These components will be installed.                     |
==> +-----------------------------------------------------+------------+---------+
==> |                         Name                        |  Version   |   Size  |
==> +-----------------------------------------------------+------------+---------+
==> | BigQuery Command Line Tool                          |     2.0.28 | < 1 MiB |
==> | BigQuery Command Line Tool (Platform Specific)      |     2.0.26 | < 1 MiB |
==> | Cloud SDK Core Libraries (Platform Specific)        | 2017.09.15 | < 1 MiB |
==> | Cloud Storage Command Line Tool                     |       4.28 | 3.3 MiB |
==> | Cloud Storage Command Line Tool (Platform Specific) |       4.27 | < 1 MiB |
==> | Default set of gcloud commands                      |            |         |
==> | gcloud cli dependencies                             | 2017.10.20 | 1.4 MiB |
==> +-----------------------------------------------------+------------+---------+
==>
==> For the latest full release notes, please visit:
==>   https://cloud.google.com/sdk/release_notes
...
==> This will install all the core command line tools necessary for working with
==> the Google Cloud Platform.
==>
==> Update done!
==>
==> ==> Source [/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc] in your profile to enable shell command completion for gcloud.
==> ==> Source [/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc] in your profile to add the Google Cloud SDK command line tools to your $PATH.
==>
==> For more information on how to get started, please visit:
==>   https://cloud.google.com/sdk/docs/quickstarts
==>
==>
==> Linking Binary 'bq' to '/usr/local/bin/bq'.
==> Linking Binary 'gcloud' to '/usr/local/bin/gcloud'.
==> Linking Binary 'git-credential-gcloud.sh' to '/usr/local/bin/git-credential-gcloud'.
==> Linking Binary 'gsutil' to '/usr/local/bin/gsutil'.
🍺  google-cloud-sdk was successfully installed!

$ which gcloud
/usr/local/bin/gcloud

$ gcloud init
Welcome! This command will take you through the configuration of gcloud.

Your current configuration has been set to: [default]

You can skip diagnostics next time by using the following flag:
  gcloud init --skip-diagnostics

Network diagnostic detects and fixes local network connection issues.
Checking network connection...done.
Reachability Check passed.
Network diagnostic (1/1 checks) passed.

You must log in to continue. Would you like to log in (Y/n)? Y

// In the browser
You are now authenticated with the Google Cloud SDK!

$ gcloud info

$ gcloud projects create japila-k8s
Create in progress for [https://cloudresourcemanager.googleapis.com/v1/projects/japila-k8s].
Waiting for [operations/pc.7497766497240024269] to finish...done.

$ gcloud projects list
PROJECT_ID             NAME              PROJECT_NUMBER
japila-k8s             japila-k8s        568266906839