johnwilliams / pipi

Dockerized Base Rails App for Raspberry Pi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Install Kubernetes

You'll need to become root then add the apt-key for google. Next you'll add the kubernetes apt repo and finally update the apt repos and then install kubeadm. This should be completed on the master and the nodes.

curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
apt-get update && apt-get install -y kubeadm

Setup Master

Kubenetes is now installed so you can initiaze the master node by running the following command:

Join Nodes

Now that your master is up and running you will want to join nodes to the cluster. The command will be shown at the end of the output from the init command you ran above. Run this command on the nodes.

Check Node Status

NAME            STATUS         AGE
pi-k8s-master   Ready,master   6m
pi-k8s-node1    Ready          14s
pi-k8s-node2    Ready          8s
pi-k8s-node3    Ready          6s

Setup Network Driver (flannel)

As of today flannel is the only network driver that works on Rpi

Check Pod Status

At this point all of your pods should be running (maybe sill creating).

NAMESPACE     NAME                                    READY     STATUS    RESTARTS   AGE
kube-system   dummy-2501624643-pw7hc                  1/1       Running   0          8m
kube-system   etcd-pi-k8s-master                      1/1       Running   0          9m
kube-system   kube-apiserver-pi-k8s-master            1/1       Running   0          8m
kube-system   kube-controller-manager-pi-k8s-master   1/1       Running   0          9m
kube-system   kube-discovery-1659614412-wzknn         1/1       Running   0          8m
kube-system   kube-dns-4211557627-vst3z               4/4       Running   0          6m
kube-system   kube-flannel-ds-k21ll                   2/2       Running   0          3m
kube-system   kube-flannel-ds-zq22w                   2/2       Running   0          3m
kube-system   kube-proxy-nctpq                        1/1       Running   0          3m
kube-system   kube-proxy-rdjnz                        1/1       Running   0          6m
kube-system   kube-scheduler-pi-k8s-master            1/1       Running   0          8m

Deploy MySQL

As of today flannel is the only network driver that works on Rpi

Deploy Rails App

As of today flannel is the only network driver that works on Rpi

Deploy Load Balancer

As of today flannel is the only network driver that works on Rpi

Now that the LB is deployed you will need to assign it to a node.

List app tier pods:

NAME                        READY     STATUS    RESTARTS   AGE
pipi-app-3795598666-32tzt   1/1       Running   0          32m
pipi-app-3795598666-jd73n   1/1       Running   1          32m
pipi-app-3795598666-qt8dl   1/1       Running   0          32m

Run DB migration on an app pod.

kubectl exec pipi-app-3795598666-32tzt bin/rails db:migrate

About

Dockerized Base Rails App for Raspberry Pi


Languages

Language:Ruby 74.6%Language:HTML 18.5%Language:CSS 5.9%Language:JavaScript 1.0%