Skip to content

Latest commit

 

History

History

gke-cluster

GKE Cluster

Pattern to produce simple Google Kubernetes (GKE) clusters.

WARNING

The clusters created by this project are not production worthy. They create zonal clusters i.e. the control plane only exists in a single Google Zone, as does the nodes for the node pool (which, by default there is one of).

Creates

  • Simple network
  • GKE cluster
  • Autoscaling node pool
  • Installs Weave Gitops Core (via Flux)
  • DNS hosted zone
  • Various service accounts

Requirements

Usage

$ make ENV=<env> tf-plan
# ...
$ make ENV=<env> tf-apply
# ...

where env should match the name of the environment to be deployed and have a corresponding tfvars file in vars/ (once you've run a make command with ENV set it should remember it by reading .terraform/environment).

Workspaces

This uses Terraform Workspaces to provide isolation between different environments.

To create a new workspace run:

$ make ENV=<new-env> tf-create-workspace

You'll need to update locals.tf's allowed_workspaces list (otherwise you'll get Invalid index errors) and add any further customisations to the newly created vars/<new-workspace-name>.tfvars file.

Workspace naming

Workspaces are currently named after the region they're deployed to. If multiple workspaces are needed in the same region they can be created with some suffix.

Flux bootstrapping

Before bootstrapping, make sure to export the GitHub PAT token for the weaveworksbot. The token is available in 1password.

export GITHUB_TOKEN="<weaveworksbot token>"
make flux-bootstrap

You might find the following error


CRITICAL: ACTION REQUIRED: gke-gcloud-auth-plugin, which is needed for continued use of kubectl, was not found or is not executable. 
Install gke-gcloud-auth-plugin for use with kubectl by following https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke

That you fix via gcloud components install gke-gcloud-auth-plugin

if you are using flux v0.33.0 you might hit this issue, so just use a previous version to bootstrap. for example 0.32.0

Notes

Networking

Long term this project is intended to allow testing of multi-cluster configurations. As part of testing the more hostile potential setups each workspace creates its own VPC and subnet, i.e. assumes that the management cluster is in an entirely separate network to its leaf cluster (this may need to be pushed further to a separate project).

Using Weave GitOps on the cluster

Access

The Weave GitOps UI should be visible here.

The username and password can be found in 1password under wego-app-staging. Contact corp-it if you do not have access to this.

Reporting bugs found the GKE cluster

If you find a bug, complete as much of the issue template as possible. For the Weave GitOps Version field, provide the tag of the image which was deployed at the time you noticed the bug. This can be found in this file under spec.chart.values.image.tag.

Logs for the weave-gitops-app deployment can be found here. If you cannot see that page, contact corp-it.

Connect a leaf cluster

Now that you have provisioned your cluster, in the case of playing the role of a leaf cluster, you might want to connect it to a mangement clusters. You could read how to connect a leaf cluster.