Difference between revisions of "Kubernetes on Novena"

From Studio Kousagi Wiki
Jump to: navigation, search
Line 1: Line 1:
 +
Kubernetes is a high-availability clustering package.  It is available for ARM, but mostly is used on x86-64.  These steps detail how to use it on Novena.
 +
 +
==Installing Kubernetes==
 +
 
Some steps I've taken to install Kubernetes on Debian.  Adapted from https://blog.hypriot.com/post/setup-kubernetes-raspberry-pi-cluster/ for Novena.
 
Some steps I've taken to install Kubernetes on Debian.  Adapted from https://blog.hypriot.com/post/setup-kubernetes-raspberry-pi-cluster/ for Novena.
  
Line 63: Line 67:
 
8. Wait for all pods to be Running:
 
8. Wait for all pods to be Running:
 
   kubectl get po --all-namespaces
 
   kubectl get po --all-namespaces
 +
 +
==Using Kubernetes==

Revision as of 11:47, 14 March 2017

Kubernetes is a high-availability clustering package. It is available for ARM, but mostly is used on x86-64. These steps detail how to use it on Novena.

Installing Kubernetes

Some steps I've taken to install Kubernetes on Debian. Adapted from https://blog.hypriot.com/post/setup-kubernetes-raspberry-pi-cluster/ for Novena.

1. Update the key.

 wget http://repo.novena.io/debian/pool/main/k/kosagi-repo/kosagi-repo_1.2-r1_all.deb
 sudo dpkg -i kosagi-repo_1.2-r1_all.deb
 apt-get update
 DEBIAN_FRONTEND=noninteractive apt-get dist-upgrade
 apt-get install apt-transport-https # Used for accessing the newer repos

2. At this point, it's probably a good idea to move to a SATA disk.

 dd if=/dev/mmcblk0 of=/dev/sda bs=1M count=1
 fdisk /dev/sda
 # Re-create partitions 2 and 3.  Make partition 2 at least 6GB
 # for swap (type 82), and make partition 3 the rest of the disk.
 # Type "x" for Expert mode, then "i", and change the ID to 0x4e6f7653.
 # Then "r" to return to the main menu, and "w" to write it to disk.
 mkfs.ext4 /dev/sda3 # or install btrfs-tools or xfsprogs and make a different type
 mount /dev/sda3 /mnt
 rsync -avxHAX --progress / /mnt/
 novena-eeprom -w -f es8328,pcie,gbit,hdmi,eepromoops,sataroot
 reboot

3. Install Docker (borrowed from https://github.com/hypriot/image-builder-odroid-c1/blob/master/builder/chroot-script.sh)

 wget -q https://packagecloud.io/gpg.key -O - | apt-key add -
 echo 'deb https://packagecloud.io/Hypriot/Schatzkiste/debian/ jessie main' > /etc/apt/sources.list.d/hypriot.list
 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 2C52609D
 echo 'deb [arch=armhf] https://apt.dockerproject.org/repo debian-jessie main' > /etc/apt/sources.list.d/docker.list
 apt-get update
 export DOCKER_ENGINE_VERSION="17.03.0~ce-0~debian-jessie"
 export DOCKER_COMPOSE_VERSION="1.9.0-23"
 export DOCKER_MACHINE_VERSION="0.9.0-39"
 DEBIAN_FRONTEND=noninteractive apt-get install \
   libltdl7 \
   docker-engine="${DOCKER_ENGINE_VERSION}" \
   docker-compose="${DOCKER_COMPOSE_VERSION}" \
   docker-machine="${DOCKER_MACHINE_VERSION}"

4. Install kubeadm

 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

5. Run kubeadm on the master device to start the cluster. As of this moment, we need to skip preflight checks due to changes in Docker version numbering.

 kubeadm init --pod-network-cidr 10.244.0.0/16 --skip-preflight-checks

It will output something like the following:

 Your Kubernetes master has initialized successfully!
 
 You should now deploy a pod network to the cluster.
 Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:
     http://kubernetes.io/docs/admin/addons/
 
 You can now join any number of machines by running the following on each node:
 
 kubeadm join --token=964a50.d8053ed3de195a11 10.0.245.169

6. Join the cluster from other machines. We still need to skip preflight checks.

 kubeadm join --token=964a50.d8053ed3de195a11 --skip-preflight-checks 10.0.245.169

7. Install Flannel on the Master, which will manage the network for us.

 curl -sSL https://rawgit.com/coreos/flannel/master/Documentation/kube-flannel.yml | sed "s/amd64/arm/g" | kubectl create -f -

8. Wait for all pods to be Running:

 kubectl get po --all-namespaces

Using Kubernetes