So this is a quick guide on how I got Kubernetes installed and running on 5 nodes on a prototype SoPine clusterboard. This can also work on rock64's, pine64(+)/LTS or anything else really. I'm assuming you already know how to flash OS SD card images using your favourite host OS, and can configure a router, in particular assigning manual DHCP addresses to hosts.
This isn't step by step, and if you need clarification, then perhaps go learn about whatever it is first. This is not a beginner's guide.
Background:
I recently got the book "Kubernetes Up & Running" (KUAR) by Hightower, Burns & Beda from O'Reilly. It came out in September 2017 so it's fairly current, although with all tech books, there are some things already out of date.
I read the intro and chapter 1 - nice and informative.
Chapter 2 - "you may want to start expriementing" it suggested. Uhhm, yes. "You should use an online service offering" it advised. Uhmm, if I have to ... "If you're really want to set it up yourself ... appendix A has a guide" it revealed. I skipped the rest of Chapter 2 for now. Chapters 3 through Appendix A, I'll get back to later as well
NB* THIS IS SO FAR FROM PRODUCTION READY.
The steps that follow are a rough paraphrase of Appendix A in the KUAR book with a few changes (ie that out of date already stuff)
Step 1- Get hardware.
This isn't step by step, and if you need clarification, then perhaps go learn about whatever it is first. This is not a beginner's guide.
Background:
I recently got the book "Kubernetes Up & Running" (KUAR) by Hightower, Burns & Beda from O'Reilly. It came out in September 2017 so it's fairly current, although with all tech books, there are some things already out of date.
I read the intro and chapter 1 - nice and informative.
Chapter 2 - "you may want to start expriementing" it suggested. Uhhm, yes. "You should use an online service offering" it advised. Uhmm, if I have to ... "If you're really want to set it up yourself ... appendix A has a guide" it revealed. I skipped the rest of Chapter 2 for now. Chapters 3 through Appendix A, I'll get back to later as well
NB* THIS IS SO FAR FROM PRODUCTION READY.
The steps that follow are a rough paraphrase of Appendix A in the KUAR book with a few changes (ie that out of date already stuff)
Step 1- Get hardware.
- Two or more sopines
- sopine clusterboard (cheats power cabling, network cabling (has built in GigE ethernet switch), cable management and all the other hassles of DIY clusters)
- I used an armbian 5.37 BSP xenial server build, any xenial build should work but stick with the minimal builds as you won't need most of what's in minimal, nevermind anything else
- Rather than installing DHCP tools on the host node, I just plugged them in an booted each sopine up sequentially, and assinged them hosts sopine[0..4] and on my router gave them IP addresses nnn.nnn.nnn.200 through 204 (where n is whatever subnet used on your router. eg 192.168.1.200 or 10.10.10.200)
- The book assumes the cluster will be isolated and hidden from the world so there are some extra network forwarding steps and configs I completely ignored as the clusterboard has it's own switch directly connected to the 'net and all nodes can see the world. Again this is *not* a production ready setup, where you'd likely have one exposed node, and all your worker nodes hidden/protected in a vlan or simiar. (Have I mentioned this is *not* a production ready setup?)
- (optional) install cssh(X) - Cluster SSH lets you blow up numerous systems at once by ssh'ing into all of them simultaneously and running things all at once. Since I haven't bothered (yet) with config management to setup the sopines, this is even more efficient #BadDevOps than ssh'ing into them individually way of doing things. (Thank you Xalius for introducing this to me!) (csshX is the OSX brew version)
- install docker.io - this is the default container engine
- install kubernetes package encryption key:
Code:curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
- Add repo to your repo's list
Code:echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" >> /etc/apt/sources.list.d/kubernetes.list
- Update and upgrade the nodes
- install actual kubernetes stuff
Code:apt install -y kubelet kubeadm kubectl kubernetes-cni
- this installed version 1.9 on my sopines
- On the master node (sopine0 in my case)
Code:kubeadm init --pod-network-cidr 192.168.1.0/24 --apiserver-advertise-address 192.168.1.200
- Make sure to use the correct network range as you may not be using the same subnet as I. This will take a while. It will also generate the <token> you need to initialise the slave nodes and will actually print out the command for the slave nodes to join the cluster
- on the slave nodes (sopine[1..n])
Code:kubeadm join --token=<token> 192.168.1.200:6443 --discovery-token-ca-cert-hash sha256:<hash>
- if it all played nice then to see your embryonic Kubernetes cluster details
Code:kubectl get nodes