KEINOS' Blog

Official blog of KEINOS but mostly for my own reference. A Japanese made in Mexico with Mexican quality. Who monkey around the jungle of codes. ;-)


Project maintained by KEINOS Hosted on GitHub Pages — Theme by mattgraham

INDEX


K3OS

Set password

sudo passwd rancher

SSH Access

ssh_authorized_keys:
- "ssh-rsa AAAA..."
- "github:KEINOS"

Login via SSH with GitHub account

ssh -i ~/.ssh/id_rsa [email protected]

Shutdown

# K3OS is based on Alpine linux so it does not have a shutdown command.
sudo poweroff

Basic kubectl commands

View nodes

kubectl get nodes

View pod information

Get Pod name and Pod log

kubectl get pods -o go-template --template '\n'
$ export POD_NAME=$(kubectl get pods -o go-template --template '\n')
$ echo Name of the Pod: $POD_NAME
...
$ kubectl logs $POD_NAME
...

Get inside the Pod

kubectl exec -it $POD_NAME -- /bin/bash

Path of the key (Node Token) to share with other nodes

The token of the server node, used as the value of “K3S_TOKEN” when configuring the worker node. You need to have root privileges to read this file.

/var/lib/rancher/k3s/server/node-token

Set up worker node

Install Rancher on VM

sudo su -
mkdir -p /etc/rancher/rke2
vi /etc/rancher/rke2/config.yaml
token: <mysecretkey>
tls-san:
  - <ip_address_of_the_server>
curl -sfL https://get.rancher.io | sh -
rancherd --help
systemctl enable rancherd-server.service
systemctl start rancherd-server.service

```bash journalctl -eu rancherd-server -f

K3S on RaspberryPi3

Before K3S installation

Japanese Manual of K3S

Difference between “agent” and “worker” node

Difference between “cluster” and “server” node