项目作者: jasondeutsch

项目描述 :
Notes regarding my home lab and personal K8s cluster
高级语言:
项目地址: git://github.com/jasondeutsch/homelab.git
创建时间: 2021-03-01T21:28:06Z
项目社区:https://github.com/jasondeutsch/homelab

开源协议:

下载


HOMELAB: THE JOURNAL

yup

Day 0: Equipment

Starting Equipment:

Choice of OS

All nodes will be headless installs of Ubuntu 20.04

Day 1: Connecting the bits and bops

Headless Install:

We setup SSH to be on by default in our OS image. Once we locate the IP of this device we can simply ssh into it.

  1. ssh ubuntu@<ip-addr>

Turning on SSH by default we get the default Raspberry Pi ssh credentials of pi and raspberry respectively.
Prior to anything else, let’s delete this user and add one of our own with slightly better security.

  1. sudo adduser <mynewuser>

Then we can set the password and confirm the changes:

  1. Adding user `<mynewuser>' ...
  2. Adding new group `<mynewuser>' (1001) ...
  3. Adding new user `<mynewuser>' (1001) with group `<mynewuser>' ...
  4. Creating home directory `/home/<mynewuser>' ...
  5. Copying files from `/etc/skel' ...
  6. New password:

Next, since this user will need sudo let’s grant that:

  1. usermod -aG sudo <mynewuser>

Finally, let’s delete the default user:

  1. userdel -r ubuntu

A Node needs a name

There are a couple of different ways to change the a hostname. In this case I used hostnamectl as it provides the benefit of not needing a restart and persisting across restarts.

  1. hostnamectl set-hostname <new-name>

caveat of your working on Ubuntu 18.04 or later then you’ll need to do an extra step due to cloud-init. This Stack Overflow addresses theissue (https://askubuntu.com/questions/9540/how-do-i-change-the-computer-name_.

Static IP

IP Binding in router

Starting in headlessmode
Add SSH file to boot image
Set IP on each device

Finishing Day 1

Do this n more times for the n more Pis.

Day 2

Day 3

To start, we’ll need a container runtime. I use Docker at work so let’s use that here:

Docker

  1. TODO install Docker

Kubernetes

  1. curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
  2. curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
  3. echo "$(<kubectl.sha256) kubectl" | sha256sum --check

Expecting kubec: ok

kubectl

  1. sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

helm

  1. curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
  2. sudo apt-get install apt-transport-https --yes
  3. echo "deb https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
  4. sudo apt-get update
  5. sudo apt-get install helm