Giter Club home page Giter Club logo

mogn-infra's Introduction

mogn-infra


Homelab cluster automation playbooks.

Configures and spins up a highly available* etcd, k3s, rancher cluster based on an arbitrary number of nodes.

*assuming a minimum of 2 server nodes and 2 load balancers

example layout

not visualized: a rancher / k3s agent role is available, I just don't have any in my cluster yet

Requirements

  • a control node

    • Ansible installed
    • cfssl installed (used to generate certs)
    • helm installed
    • ssh access to the host nodes
  • 1+ server / agent node

  • optional: 1+ external load balancer node, otherwise traefik will be used internally (ships with k3s)

  • a hosts file:

      [servers]
      node-1 ip=<node-1-ip>
      node-2 ip=<node-2-ip>
      node-3 ip=<node-3-ip>
    
      [agents] <- optional
      node-4 ip=<node-4-ip>
    
      [loadbalancers] <- optional
      lb-1 ip=<lb-1-ip>
      lb-2 ip=<lb-2-ip>
    
  • a vars/env.yml file:

      ---
    
      K3S_TOKEN: "<CUSTOM_TOKEN>"
      DNS_NAME: "<CUSTOM_DNS_NAME>"
      VIRTUAL_IP: "<CUSTOM_VIRTUAL_IP>"
      KEEPALIVED_PASSWORD: "<CUSTOM_PASSWORD>"
    

    A template for these files can be created with ansible-playbook init.yml


Running the playbook(s)


Initialize hosts and vars/env.yml files (optional):


ansible-playbook init.yml

Don't forget to update the values to fit your cluster.

---

Main provisioning playbook:


ansible-playbook provision.yml

The default behavior of provision.yml is to run the kubectl.yml playbook at the end which copies and adds the kubeconfig to the local control node for access to the cluster. If you would like to skip this step append -e nokubectl=True to the command e.g:

ansible-playbook provision.yml -e nokubectl=True

Verifying the cluster


source ~/.profile

kubectl get nodes

Create a DNS record or /etc/hosts entry for the load balancer or one of the rancher servers if you didn't set any up. Browse to the DNS_NAME url (e.g rancher.mogn.co) that you set in the vars/env.yml file and you should see the Rancher welcome screen.

ROADMAP

mogn-infra's People

Contributors

semoog avatar

Stargazers

 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.