Sysadmin > RancherOS

Quick how to RancherOS and Rancher

Waschzettel / blurb

RancherOS is a very dockercentric linux OS.

  1. boot iso
  2. sudo passwd rancher
  3. ssh rancher@
  4. Start a simple webserver on a Mac (192.168.11.64) with /usr/bin/python -m SimpleHTTPServer 8000
  5. sudo ros install -c http://192.168.11.64:8000/cloud-config.yml -d /dev/sda

the cloud-config.yml for this example:
ssh_authorized_keys:
  - ssh-ed25519 AC1lZDI1NTE5AC2s3Yv65JAAAC3NzaC9kcTsAAAIBIKgQeBHt+W4rfXqjAwIaYdPqka7 foo
hostname: ifuru
rancher:
  resize_device: /dev/sda
  network:
    interfaces:
      eth0:
        address: 192.168.11.222/24
        gateway: 192.168.11.2
        mtu: 1500
        dhcp: false
    dns:
      nameservers:
        - 8.8.8.8
        - 192.168.11.2
write_files:
  - container: ntp
    path: /etc/ntp.conf
    permissions: "0644"
    owner: root
    content: |
      server 192.168.11.13 iburst
      server 192.168.11.212 iburst
      server 192.168.11.213 iburst
      server 134.34.3.19 iburst

      # Allow only time queries, at a limited rate, sending KoD when in excess.
      # Allow all local queries (IPv4, IPv6)
      restrict default nomodify nopeer noquery limited kod
      restrict 127.0.0.1
      restrict [::1]

Mointoring hardware with netdata

docker run -d --name=netdata \
  -p 19999:19999 \
  -v netdatalib:/var/lib/netdata \
  -v netdatacache:/var/cache/netdata \
  -v /etc/passwd:/host/etc/passwd:ro \
  -v /etc/group:/host/etc/group:ro \
  -v /proc:/host/proc:ro \
  -v /sys:/host/sys:ro \
  -v /etc/os-release:/host/etc/os-release:ro \
  --restart unless-stopped \
  --cap-add SYS_PTRACE \
  --security-opt apparmor=unconfined \
  netdata/netdata

Open http://192.168.11.222;19999/ in a browser.

Rancher

Start Rancher in docker

testenvironment (server and agent on the same machine)

docker run -d --restart=unless-stopped \
  -p 8080:80 -p 8443:443 \
  rancher/rancher:latest

For persistens add -v /opt/rancher:/var/lib/rancher

persistant in production (server and agent on different machines)

docker run -d --restart=unless-stopped \
  -p 80:80 -p 443:443 \
  -v /opt/rancher:/var/lib/rancher \
  rancher/rancher:latest

Create cluster

Open http://192.168.11.222:8443/ in a browser.

Follow instructions on https://rancher.com/docs/rancher/v2.x/en/quick-start-guide/deployment/quickstart-manual-setup/