GithubHelp home page GithubHelp logo

diegodurrod / ansible_role_microk8s Goto Github PK

View Code? Open in Web Editor NEW

This project forked from istvano/ansible_role_microk8s

1.0 0.0 0.0 93 KB

Ansible role to install microk8s on ubuntu

License: MIT License

Shell 93.33% Python 2.54% Jinja 4.13%

ansible_role_microk8s's Introduction

Ansible Role: microk8s

Role to download and install microk8s the smallest, simplest, pure production K8s.

Requirements

  • Ansible >= 2.7
  • Linux Distribution
    • Debian Family
      • Ubuntu
        • Xenial (16.04)
        • Bionic (18.04)
        • Focal (20.04) (untested)
        • Jammy (22.04) (untested)
    • Arch Linux (untested)

License

MIT

Usage

Role Variables

Some variables available in this role are listed here. The full set is defined in [defaults/main.yml](defaults/main.yml).

  • microk8s_version: Version to use, defaults to 1.27/stable.
  • microk8s_plugins: Enable/disable various plugins. A string will be passed as arg when enabling addon using name:arg
  • microk8s_enable_HA: Enable/disable high-availability.
  • microk8s_group_HA: Hostgroup whose members will form HA cluster.
  • microk8s_group_WORKERS: Hostgroup whose members will act as worker nodes only (no control-plane components run here)
  • microk8s_csr_template: If defined, will cause a custom CSR to be used in generating certificates.

Basic playbook

- hosts: servers
  roles:
    - role: diegodurrod.microk8s
      vars:
        microk8s_plugins:
          dns: "1.1.1.1"
          istio: true
          ingress: true

Note: when overriding plugins list, it is recommended to copy-paste the entire list of plugins from the defaults/main.yml because some Ansible tasks reference them (e.g. helm3) and the deployment may fail.

Custom certificate request template

It might be useful to customize the certificate request template used by MicroK8s in generating cluster certificates. For example, additional SANs can be added to the certificates such that the MicroK8s certificates validate when addressed from outside the cluster, such as through a reverse proxy.

To generate a CSR template, the easiest is probably to use the role without a template, and then copy the CSR in /var/snap/microk8s/current/certs/csr.conf.template to your playbook's templates directory, make the edits and set the microk8s_csr_template variable accordingly, and re-run the playbook.

Adding worker only nodes (1.23+ only)

It is possible to configure additional nodes to act as workers only within your microk8s cluster. This is possible by configuring the ansible hostgroup microk8s_WORKERS (name of the group is configurable via microk8s_group_WORKERS). Every host listed within the hostgroup will essentially run microk8s join .... --worker, more info on this can be found here: microk8s-clustering.

Testing

Using Molecule wrapper and system Python

  • ./moleculew lint
  • ./moleculew create
  • ./moleculew list
  • ./moleculew check
  • ./moleculew test

Using Python virtual environment

  • Set up virtual environment
    $ python3 -m venv venv
    
  • Activate the environment
    $ . venv/bin/activate
    
  • Install Molecule with lint and Docker options
    $ pip install 'molecule[lint,docker]'
    
  • Install up-to-date Ansible package if necessary
    $ pip install ansible
    
  • Run the test commands:
    • molecule lint
    • molecule create
    • molecule list
    • molecule check
    • molecule test

ansible_role_microk8s's People

Contributors

adamcstephens avatar badri avatar byjg avatar defilan avatar diegodurrod avatar dyasny avatar ericpardee avatar eshikhov avatar iambryancs avatar istvano avatar jack1902 avatar markmywords avatar obsh avatar phunyguy avatar projectinitiative avatar turiok avatar vondowntown avatar

Stargazers

 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.