/circleci-k8s-gcp-hello-app

A sample project that demonstrates using CircleCI to deploy to Google Kubernetes Engine on GCP

Primary LanguageGoMIT LicenseMIT

circleci-demo-k8s-gcp-hello-app

CircleCI

This project demonstrates continuous delivery with CircleCI and Google Kubernetes Engine using Docker and Kubernetes.

This project is based on the demo tutorial here: https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app

The code for the hello-app application was based on this repository: https://github.com/GoogleCloudPlatform/kubernetes-engine-samples/tree/master/hello-app

Prerequisites

  • GCP project: A GCP project created from the Kubernetes Engine page in the Google Cloud Platform Console (or one with Kubernetes Engine API and related services enabled)
  • GCP service account: A GCP service account must already exist before running the build, and it needs to have sufficient privileges to manage the project's resources

Required Environment Variables

Note that the following environment variables must be set for the project on CircleCI via the project settings page:

  • GCLOUD_SERVICE_KEY: <base64-encoded GCP service account key value>
  • GOOGLE_PROJECT_ID: e.g. hello-app-12345
  • GOOGLE_CLUSTER_NAME: e.g. cluster-1 (the cluster will be created if it doesn't yet exist)
  • GOOGLE_COMPUTE_ZONE: e.g. us-central1-a
  • DOCKER_IMAGE_NAME: e.g. gcr.io/hello-app-12345/hello-app (should match project id)
  • DELETE_CLUSTER_AT_END_OF_TEST: true|false (If set to true, the deployment's resources including the cluster named by GOOGLE_CLUSTER_NAME will be deleted after the test. This will prevent unwanted charges incurring on your GCP account)

Useful References