Skip to content

bcatouillard/k8s-cluster-provisioning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build A Kubernetes cluster using Terraform

Being able to build a Kubernetes cluster by provisioning GCP Compute Engine Instances.

Project scheme

GCP Project

Multiple accounts in gcloud CLI? Create a new configuration and activate it using:

gcloud config configurations activate <CONFIG_NAME>

Required stack

To run this you'll need few things:

  • Terraform
  • Ansible
  • Folder in root project ./.ssh

Terraform part

It will create 3 instances:

  • 1 controlplane
  • 2 worker nodes

Each instance is labeled with ansible-group to define if it's either a controlplane or a node.

It will create a new Service Account and a SSH key that will be used as a user to connect using SSH for Ansible.

Ansible part

It will by using 4 roles, install all dependencies and create a Kubernetes cluster.

I have defined 4 roles:

  • Prepare-cluster: that will install common dependencies such as kubeadm, kubelet, containerd, etc...
  • Master: that will install kubectl and create the cluster
  • Node: that will make the worker node join the cluster previously created.
  • Weave: that will install the CNI (WeaveNet)

About

Provisionning a K8s cluster using Terraform and Ansible

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published