Giter Site home page Giter Site logo

kubernetes-cluster's Introduction

Deploy a non-production Kubernetes cluster for studies, tests and whatever is your necessity

The purpose of this project is to deploy a k8s cluster on AWS (or any other cloud provider, if you are familiar with Terraform) using IaC tools, like Ansible and Terraform. Currently, it works only on Debian-based distros, but I'm looking forward to making it more embracing. ;)

This project consists of:

Ansible Roles:

  • Containerd: this role is responsible for installing and enabling containerd on all instances provisioned by Terraform.
  • Kubernetes Master: once containerd is enabled, this role is executed and tools like kubeadm, kubectl and kubelet are installed on instances responsible for being the control plane. It also initiates the control plane and gets the join command for further use of workers.
  • Kubernetes Worker: here all the necessary components are installed and enabled on instances specified as workers in the inventory file. This role also executes a task for joining the cluster.

Terraform files:

For now, every resource is written in the "main.tf" file, but I'm also looking forward to modularizing it for a better understanding.
Except for the access and secret keys, every variable has a default value, but feel free to change it or add more values according to your knowledge.

Attention: by default, I used every first index of a list for the master node configuration (like in the "machine_names" variable), but you can change it if needed.

Setting up and running it:

  1. Install Terraform and Ansible;

  2. Get your AWS secret and access key;

  3. Cd into terraform directory;

  4. Open the terraform.tfvars file and paste the access and secret keys on their respective fields;

  5. Change any configuration according to your necessity; (optional)

  6. Run terraform init and awaits its completion;

  7. Run terraform plan and check if everything is alright;

  8. Run terraform apply if everything is fine and awaits its completion;

  9. SSH into your machines. Ex.: ssh -i "instance_key.pem" <username>@<public_ip/dns>;

  10. Change to "kube" user with sudo su kube command;

  11. Run your k8s resources. Ex.: kubectl run nginx --image nginx --port 80

  12. Enjoy it! :)

kubernetes-cluster's People

Contributors

loureirovinicius avatar lacvinicius 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.