Giter VIP home page Giter VIP logo

gke-cluster's Introduction

Single Node GKE Cluster - Terraform

This terraform repo will deploy a single node (by default) GKE cluster for quick LAB purposes. Available in 2 versions:

  1. Plain GKE cluster
  2. GKE cluster with Gitlab K8s agent integration

Prerequisites

The following tools must exist on the machine where the terraform will be executed:

  1. gcloud CLI
  2. gke-gcloud-auth-plugin

For lazy hands:

# Install Gcloud for Debian/Ubuntu
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-cli kubectl jq -y
sudo gcloud components install gke-gcloud-auth-plugin

To authenticate to Gcloud:

# Using your user
gcloud init 

# Then
gcloud auth application-default login

How to use

GKE Only

  1. Authenticate gcloud
  2. Create a terraform.tfvars file (example) and fill the required input variables
  3. Do terraform init
  4. Plan and apply

GKE with Gitlab K8s agent setup

  1. Create a Gitlab Agent for Kubernetes, and retrieve the token.
  2. Same steps with the GKE Only

Sample tfvars files

terraform.tfvars

project_id = "default-project"
region = "asia-southeast2"
zone = "asia-southeast2-a"
machine_type = "e2-small"

For Gitlab K8s agent setup, include the required variables:

agent_namespace = "gitlab-agent"
agent_token = abcdef123456789
agent_kas_address = wss://gitlab.com/-/kubernetes-agent/"

Terraform input vars

Name Description Type Default Required
project_id GCP Project ID string n/a yes
region GCP Project region string "asia-southeast2" yes
zone GCP Project zone string "asia-southeast2-b" yes
machine_type GKE Node Machine type string "e2-medium" yes
node_count GKE node count int 1 yes
is_preemptible_node_pool Whether the nodepool is preemptible or not bool true yes
agent_namespace Gitlab agent namespace string "gitlab-agent" yes in gitlab k8s agent
agent_token Gitlab agent token string n/a yes in gitlab k8s agent
kas_address KAS address string n/a yes in gitlab k8s agent

gke-cluster's People

Contributors

annahri avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.