Coder Social home page Coder Social logo

rke2-terraform-libvirt's Introduction

rke2-terraform-libvirt

Lint Scripts linter tfsec

A repository that creates a RKE2 kubernetes cluster using Terraform.

Out of the box it comes configured with:

  • pre-checks all the requirements are met for the setup to run;
  • checks kubernetes API is running and nodes are available after apply;
  • generating ssh key for kubernetes user, to be used to connect to the VMs (instead of password login);
    • makes use of ssh-agent to load key;
    • key is password protected and generated once;
  • generating tf.vars file based on template in file terraform-template.json;
  • exports kubernetes config file to k8s.yaml in root folder;
  • kubernetes rke2 additions:
    • system-upgrade controller, to be able to run plans from https://docs.rke2.io/upgrade/automated_upgrade/#configure-plans ;
    • custom audit policy to have more precise logging;
    • wireguard added and configured;
    • automountServiceAccountToken set to false, by default;
    • iptables configured to restrict traffic between nodes on specific ports. Configuration is persistent on reboot;
    • (optional) mirror for docker hub with username and password can be configured by adding to the terraform-template.json:
      "registry_mirror": "mirror.example.com",
      "registry_mirror_user": "example",
      "registry_mirror_pass": "example"

Usage

Creating kuberentes cluster

# generate keys and load terraform modules
make init

# create plan based on template (need to run once)
make plan

# apply configuration
make apply

On make init new ssh keys are generated only if they don't exist, and the password is generated once. If the keys want to be reused and the key has been removed from the ssh-agent, export SSH_PASS=<key> needs to be used for the make init to know how to add the keys to the ssh-agent.

Destroy kubernetes cluster

# destroy cluster

make destroy

License

MIT License

Code adapted from from https://github.com/hoeghh/rke2-terraform/ which is licensed under MIT License

rke2-terraform-libvirt's People

Contributors

blankdots avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

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