kigawas / k8s-on-gce

Use Infra as Code to pop a k8S cluster on gcp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Kubernetes on Google Computing Engine

This project leverages hype tools πŸ˜‰ (terraform πŸ—, ansible πŸ› , docker 🐳, ...) to automate the deployment of a 6 vms (3 controllers πŸ‘©β€βœˆοΈ, 3 workers πŸ‘·β€) kubernetes cluster on GCE.

How to use πŸ—Ί

  • Put your adc.json in the app dir (See Gcloud account for details on this file) .
  • Adapt profile to match your desired region, zone and project
  • Launch ./in.sh, it will build a docker image and launch a container with all needed tools
  • In the container, launch ./create.sh and wait for ~10mins
  • And you're done ! πŸš€

🚽 When you finish, launch ./cleanup.sh to remove all gce resources.

Versions

All versions are set as environment variables in the Dockerfile. You can adapt it if you want to try other versions

Gcloud account

To interact with Gcloud API we use a service account. The adc.json is your service account key file. You can find more infos on how to setup a service account here.

Addons

Traefik ingress

  • Go to 13-addons dir: cd 13-addons
  • Launch ./deploy-traefik.sh, this will create the cluster role needed for traefik, the traefik daemonset and the firewall rule to enable trafic in

Dashboard

  • Go to 13-addons dir: cd 13-addons
  • Launch ./deploy-dashboard.sh, this will create the service account used for the dashboard (⚠️ with tihs configuration, the service account is bound to the cluster-admin role)
  • Follow the displayed instructions

Tests

  • Go to 14-example dir: cd 14-example
  • Deploy whoami app example: kubectl apply -f whoami.yml

Credits πŸ‘

This work is an automation of kubernetes-the-hard-way

About

Use Infra as Code to pop a k8S cluster on gcp


Languages

Language:Shell 83.9%Language:HCL 10.9%Language:Dockerfile 5.2%