Giter Club home page Giter Club logo

k3s-raspberry-ansible's Introduction

k3s raspberry ansible

This repository contains Ansible scripts to deploy a k3s on Raspberry PI.

Scripts are based on k3s.io scripts, you can found the original scripts here

Raspberry preparation

Install Raspberry Pi

Enable SSH connection

  • Add empty ssh file on the boot partition

Change hostname

sudo raspi-config
  • 1 - System Options
  • S4 Hostname

Set SSH key for connection

  • Run powershell as administrator

  • Generate public/private ecdsa key pair.

ssh-keygen -t ecdsa -b 521
  • Apply public key on all servers
$PUBKEYPATH="$HOME\.ssh\id_ecdsa.pub" # public key localisation
$HOSTS= @("[email protected]","[email protected]","[email protected]") # servers list

$HOSTS | Foreach-Object { 
    $pubKey=(Get-Content "$PUBKEYPATH" | Out-String); ssh $_ "mkdir -p ~/.ssh && chmod 700 ~/.ssh && echo '${pubKey}' >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys" 
}
  • Initialise ssh agent and add current key
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent

ssh-add

Ansible Scripts

Inventory

  • master: Kubernetes master
  • node: Kubernetes worker node
  • tools: server with tools to manage the Kubernetes server (kubectl, helm)

Playbook

Tools/plugins installed:

  • k3s
  • Kubernetes dashboard (Helm)
  • Longhorn (Helm)
  • Ingress nginx (Helm)

Ansible galaxy collections required:

  • community.general
  • community.kubernetes

Install the k3s

ansible-playbook site.yml -i inventory/hosts.ini

uninstall the k3s

ansible-playbook reset.yml -i inventory/hosts.ini

Reminders

Dashboard access

  • run
kubectl proxy

Find kubernetes dashboard secrets token

kubectl -n dashboard describe secret $(kubectl -n dashboard get secret | where-object { $_.startswith('dashboard-token') } | ForEach-Object { $_ -Split '\s+' } | Select -First 1)

k3s-raspberry-ansible's People

Contributors

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