• This repository has been archived on 04/Apr/2023
  • Stars
    star
    161
  • Rank 233,470 (Top 5 %)
  • Language HCL
  • License
    Apache License 2.0
  • Created over 5 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Terraform module to create a best-practise Google Kubernetes Engine (GKE) cluster.

Terraform Google GKE Cluster

A Terraform module to create a best-practice Google Kubernetes Engine (GKE) cluster.

This module is available on Terraform registry.

The module is designed to be used by Jetstack customers to make it easier for them to create clusters that are secure and follow Jetstack recommendations. It gives them flexibility with certain properties so the cluster can be customised to their needs, but gives fixed values for properties that could lead to issues or insecurity.

Deprecation

⚠️ The 0.3 release of this module is planned to be the final release. ⚠️

After this the module will be deprecated in favour of Google's GKE module. Jetstack will be producing an example project using Google's module as well as migration guidance.

Requirements

The module requires an existing Google Cloud project, with VPC network and subnetwork for the cluster to use. The subnetwork must be in the same region as the cluster and have pod and service ranges specified.

Customisable Properties

The module allows the cluster to be extensively customised using input variables. These can be found with documentation in variables.tf.

The customisable properties include:

  • Release channel or minimum master version
  • Private nodes
  • Master private endpoint
  • Master authorised network CIDR blocks
  • Master CIDR block
  • Node service account container registry access
  • Google security group for RBAC
  • Workload identity namespace
  • Enable Stackdriver logging and monitoring
  • Enable Google Cloud HTTP load balancing
  • Enable pod security policy controller
  • Daily maintenance window start time
  • Node pools
    • Name
    • Inital node count
    • Minimum and maximum number of nodes for autoscaling
    • Enable automatic repair and upgrade
    • Machine type
    • Disk size and type
    • Use preemptible nodes
    • Kubernetes version

Fixed Arguments

Some of the properties of the cluster are fixed based on Jetstack's recommended best-practice settings:

  • Enabling network policy for nodes and master using Calico.
  • Disabling basic authentication and client certificate issuing.
  • Disabling Kubernetes dashboard (Google Cloud Console should be used instead).
  • Use of VPC native networking (using a specified network and subnetwork).
  • Removing the default node pool and creating one or more new pools with Terraform for easier management.
  • Setting the OAuth scope of nodes to cloud-platform to manage permissions with IAM.
  • Disabling node legacy endpoints.
  • Creating an IAM service account for nodes with the minimum required roles:
    • Logging log writer
    • Monitoring metric writer
    • Monitoring viewer

Usage

The module itself is located in the root of this repo, and is designed to be used as part of a larger Terraform project. It can be used directly from the Terraform Registry like so:

module "gke-cluster" {
  source  = "jetstack/gke-cluster/google"
  version = "0.3.0"

  # insert the 9 required variables here
}

Example

There is an example project in the example/ directory which can be used to test and demonstrate the module. It could also be used as the basis for your own Terraform project.

Limitations

If private nodes are used then nodes will not have direct access to the internet. This means they cannot pull images hosted outside of the container registry in the same project as the cluster. The example project features a Cloud NAT to give the nodes to access the internet.

License

This project is licensed under the Apache 2.0 License. For full details see the LICENSE file.

More Repositories

1

kube-lego

DEPRECATED: Automatically request certificates for Kubernetes Ingress resources from Let's Encrypt
Go
2,161
star
2

version-checker

Kubernetes utility for exposing image versions in use, compared to latest available upstream, as metrics.
Go
695
star
3

kube-oidc-proxy

Reverse proxy to authenticate to managed Kubernetes API servers via OIDC.
Go
476
star
4

navigator

Managed Database-as-a-Service (DBaaS) on Kubernetes
Go
271
star
5

tarmak

A toolkit for Kubernetes cluster provisioning and lifecycle management
Go
269
star
6

jetstack-secure

Open-source components of Jetstack Secure.
Go
251
star
7

paranoia

Inspect certificate authorities in container images
Go
228
star
8

vault-unsealer

Vault Unseal automation
Go
129
star
9

cni-migration

A CLI to migrate the CNI on a Kubernetes cluster from Canal (Calico + Flannel) to Cilium, live with no downtime.
Go
74
star
10

google-cas-issuer

cert-manager issuer for Google CA Service
Makefile
73
star
11

getting-started-kubernetes

Getting Started with Kubernetes Workshop
Go
65
star
12

kubebuilder-sample-controller

k8s.io/sample-controller written with kubebuilder v2
Go
63
star
13

okta-kubectl-auth

Go
40
star
14

kustomize-cert-manager-demo

Demo using Kustomize for per-environment deployment of cert-manager
26
star
15

dependency-track-exporter

Go
23
star
16

vault-helper

Vault helper script
Go
22
star
17

letsencrypt-caa-bug-checker

Tool to check your Kubernetes cluster for certificates affected by Let's Encrypt's CAA rechecking bug
Go
21
star
18

cert-manager-nginx-plus-lab

Lab demonstrating cert-manager, nginx-plus and Venafi
Shell
19
star
19

knet-stress

A simple networking stress test introspective for Kubernetes.
Go
19
star
20

elasticsearch-pet

An elasticsearch image for kubernetes PetSets
Shell
18
star
21

tally

Go
14
star
22

finops-stack

Go
9
star
23

cert-manager-external-issuer-example

An example repository implementing an external LocalCA issuer type
Go
9
star
24

tekton-demo

Demonstration of Tekton pipelines to supplement our blog post
Jsonnet
8
star
25

airworthy

Go
7
star
26

spiffe-workload-identity-demo

Demo of using cert-manager SPIFFE for for workload identity
Go
3
star
27

seaglass

Go
3
star
28

jwt-registry-auth

Go
3
star
29

ingress-yubikey

Experimental Kubernetes Ingress Controller using a Yubikey for an HSM
Go
2
star
30

spiffe-connector

Using SPIFFE Verifiable Identity Documents to seamlessly authenticate to existing services.
Go
2
star
31

slingshot-cp-ansible-k8s-coreos

Slingshot config-provider for setting up Kubernetes on CoreOS using Ansible
Python
2
star
32

jsctl

CLI tool for Jetstack Secure
Go
2
star
33

cassandra-kubernetes-seed-provider

Java
2
star
34

service-mesh-con-2021-service-identity

Scripts that I used in demos for the 2021 ServiceMeshCon talk; Service Identity - The Key to Zero Trust with
Shell
1
star
35

ubuntu-nsenter

Image containing nsenter, required when running minikube on travis with helm
1
star
36

puppet-module-kubernetes_addons

Puppet module for Kubernetes cluster addons
Ruby
1
star
37

puppet-module-calico

Puppet module for Calico overlay network
Ruby
1
star
38

puppet-module-etcd

Puppet module for Etcd
Ruby
1
star
39

jetstack-secure-gcm

Contains configuration and user guide for the Jetstack Secure for cert-manager offering on the Google Cloud Marketplace.
Mustache
1
star