Skip to content

Repository files navigation

Running Kubernetes on Google Cloud Platform using Terraform

Terraform

Infrastructure is managed using Terraform via the Google Cloud provider, which handles resources such as:

  • CloudDNS and compute addresses
  • Container clusters
  • Networking

Kubernetes

Cluster components and some cluster-specific infrastructure resources are managed through Kubernetes:

  • App deployments, services and ingress
  • GCP load balancers (via ingress)
  • Cache stateful sets
  • Secrets for the app and SSL certificates
  • Autoscaling

Prerequisites

Google Cloud Platform project

You need to have a service account with Project / Editor role and the GKE API enabled in the project.

Create a new service account key and download as account.json to config.

More info and step by step guide with screenshots here.

Google Cloud command-line tool, gcloud

You can either install it from the official source or using Homebrew Cask if you’re on a Mac:

brew tap caskroom/cask
brew cask install google-cloud-sdk

Once it’s installed, log in and set it up for the project:

gcloud components update
gcloud auth application-default login
gcloud config set compute/zone europe-west2-b

Terraform

  • Terraform CLI 0.11+
  • A GCP service account key

Download the Terraform CLI from their site, or install it using Homebrew is you’re on a Mac:

brew install terraform

Kubernetes command-line tool, kubectl

You can either install it from the official source or using Homebrew if you’re on a Mac:

brew install kubernetes-cli

Exercise 1 - Deploying a single Docker image to GCP with gcloud

This exercise gets us started with deploying a single Docker image to GCP using the gcloud CLI.

Let’s do it, onwards to Exercise 1!

Exercise 2 - Deploying a single Docker image to GCP with Terraform

We’re ready to take on Kubernetes with Terraform.

Let’s do it, onwards to Exercise 2!

Exercise 3 - Deploying an autoscaling Kubernetes services to GCP with Terraform

Autoscaling

Let’s do it, onwards to Exercise 3!

About

No description, website, or topics provided.

Resources

Stars

13 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages