Downward scaling the cloud

One of the things you will find as you go on your journey through the cloud is that the downward-scalability is very poor. Cloud is designed for a high upfront cost (people time and equipment $$$). But after that, it scales very linearly for a long way.

This is great if you are a cog in a wheel of a big organisation, and you have a business which is about to head to infinity. But, if you are just looking to develop and learn a bit on your laptop, and don't have access to (moderate) big iron, it can be frustrating.

My laptop is no slouch. 2C4T, 16GB ram with a 7200U. But, well, it is a bit challenged when posed with a lot of work. And when you start talking about 'scale-out' and 'min-replicas=3' for things, the heat heads to infinity, and the performance towards 0.

So I've been looking at other methods. And there are two vectors.

  1. Making the big complex stuff installable by the 'hobbyist' without learning the universe or operating the full stack
  2. Tuning things down while keeping enough behaviour to be real.
  3. (or 3 really, get some cloud credits and ignore these 2 problems).

One method of course is just use external machines. But sometimes you are mobile and don't have that elusive Internet.

Kubernetes is an example of these beasts. It uses a lot of resources, its large, hard to install. None of this matters when you add the 1000'th instance to a big cluster. But when you are adding the first...

One tool I've been using is 'kube-spawn'. I've made a few pull requests to it, it allows installing a multi-node Kubernetes with a CNI (weave|calico|flannel|canal), all using containers. So your single host runs e.g. 4 containers (1 master, 3 nodes). From there, the universe thinks you have a 3-node cluster and you can do things like test 'network-policy' or 'StatefulSet'.

Of course, a lot of people use minikube.  It works. But not everyone has enough ram to hard-partition it into that VM it wants. Why not run native if you are just testing things out?

Got docker running? Then you can just do this below.

As a warning, although Kubernetes will be running inside docker containers, it now has quite a bit of access to your host, so I wouldn't use this with any external network access. Caveat emptor. YMMV.

sudo curl -Lo /usr/local/bin/minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x /usr/local/bin/minikube      

export KUBECONFIG=~/.kube/config-minikube
sudo -E minikube start  --apiserver-ips 127.0.0.1 --apiserver-name localhost --vm-driver=none --v=10

If you see kube-dns restarting with this message:

`nanny.go:116] dnsmasq[34]: Maximum number of concurrent DNS queries reached (max: 150)`

Then you might need to:

rm -f /etc/resolv.conf
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

Tired of it? Reset it all:

sudo -E minikube delete  ; sudo rm -rf /etc/kubernetes/ /var/lib/kubeadm.yaml
Tagged with: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*