/crypto-k8s

Crypto Wallets on Kubernetes

Primary LanguageDockerfileGNU General Public License v3.0GPL-3.0

crypto-k8s

Crypto Wallets on Kubernetes

Atomic pi cluster

Development Environment

  • MacBook Pro (16gb ram)
  • 4 x Atomic Pi (x86 Intel, 2gb ram, 32gb ssd)
  • Raspberry Pi 4 NFS Server (4gb ram, 1tb ssd)
  • k3s
  • MetalLB
  • Skaffold
  • VS Code

Index

  1. Prepare development environment.
  2. Install NFS server.
  3. Install k3s cluster.
  4. Configure MetalLB.
  5. Deploy crypto wallets.
  6. Deploy block explorers.*
  7. Deploy web wallets.*
* = Incomplete or Not Started

1. Prepare development environment.

A. Configure Atomic Pi's for k3s.

sudo nano /etc/hostname
  • Disable Swap
  • Set Static IP
sudo nano /etc/dhcpcd.conf
  • Add the following to the end of file, editing to fit your needs.
interface eth0
static ip_address=192.168.0.87/24
static routers=192.168.0.1
statis domain_name_servers=75.75.75.75

B. Add host entries to /user/username/.ssh/config.

  • Example ssh config file located on MacBook Pro:
# example atomic pi ssh config
# example path: /user/username/.ssh/config
Host atomic
  HostName atomic.local
  Port 22
  User atomicpi
  IdentityFile ~/.ssh/id_openvpn

Host atomic2
      HostName atomic2.local
      Port 22
      User atomicpi
      IdentityFile ~/.ssh/id_openvpn

Host atomic3
      HostName atomic3.local
      Port 22
      User atomicpi
      IdentityFile ~/.ssh/id_openvpn

Host atomic4
      HostName atomic4.local
      Port 22
      User atomicpi
      IdentityFile ~/.ssh/id_rsa

C. Install Ansible and skaffold on MacBook Pro

brew install ansible skaffold

2. Install NFS server.

A. Update Raspberry Pi 4 and upgrade.

sudo apt update && sudo apt upgrade -y

B. Install the NFS server packages.

sudo apt-get install nfs-kernel-server portmap nfs-common

C. Create the NFS folder for sharing.

export MOUNT=/media
mkdir -p $MOUNT/nfs && \
sudo chmod -R 777 $MOUNT/nfs
sudo chown nobody:nogroup $MOUNT/nfs

D. Add share folder to /etc/exports.

sudo echo -e "$MOUNT/nfs 192.168.1.0/24(rw,sync,no_subtree_check,insecure,no_root_squash)" >> /etc/exports

E. Reset exports.

sudo exportfs -a

F. Restart the NFS service.

sudo systemctl restart nfs-kernel-server

3. Install k3s cluster.

A. Use Ansible playbook.

  • Download the latest playbook
git clone https://github.com/boyroywax/crypto-k8s

B. Configure the playbook.

  • Add your master and nodes to hosts.ini, use the Host name from the ssh config file.
# ansible-k3s-atomicpi/hosts.ini
[master]
atomic

[node]
atomic2
atomic3
atomic4

[k3s-cluster:children]
master
node
  • Edit group_vars/all.yml. Pay attention to the IP of your master.
    Full_clean_install deletes all previous k3s files for a fresh install.
    The file is commented with the variables description.

C. Run the Ansible playbook. *

make

D. K3s config file located at ansible-k3s-atomic/files/k3s.yml

export KUBECONFIG=$PWD/ansible-k3s-atomic/files/k3s.yml
kubectl get nodes # test by checking for nodes

4. Configure MetalLB

A. Edit the IP address range in config.yaml.

B. Run the run_metal.sh script.

./run_metal.sh

5. Deploy crypto wallets.

A. Deploy with scripts.

  • Create crypto namespace.
kubectl create ns crypto
  • Run deploy_all.sh script.
./deploy_all.sh
  • Clean Up: Remove crypto wallets.
./delete_all.sh
  • Getinfo from all the running wallets.
./getinfo_all.sh

B. Deploy with skaffold.

  • Individually start a wallet
cd wallet-docker/coinname-wallet-docker
skaffold run --tail

C. Deploy with Helm - NOT COMPLETE