Things I wished I knew before I started with Kubernetes
Well, I just spend another 5 hours getting crap to work on my laptop. It fucking hurts haha. Knowing that it ain’t gonna be a smooth ride is already a good prep.
OK so lets start with some things that I’ve found out.
Kubes and kubectl
You’ll keep adding the namespace with almost every command you type. For instance:
kubectl get pods -n platform
kubeclt get services -n platform
It get really tiresome if you’re working with it a lot in the same namespace. You can install kubens
to switch the namespace temporarily and it will be added to each command automatically.
Kubernetes on Docker for Mac is probably the way to go
I was working with minikube, and it was all fine and dandy and I was super happy that enabling ingress was just a minikube addons enable ingress
away.
But my joy really come to a halt when i had to add a bunch of vhosts to my dev cluster. I simply wanted to route a bunch www.yolo.com
and whatever.yolo.com
to my ingress exposed loadbalancer and that’s where the fun began.
I could just change my /etc/hosts
on my mac, and this allowed it to be accessed from the outside towards my cluster. But this didn’t mean that the internal pods could access it. So me SSH’ing into minikube with minikube ssh
changing the /etc/hosts
to no avail. Nothing worked.
I ultimately tried to swap kube-dns
to fix custom entries with coredns
. But it was really a bunch of pain. Man. why can’t it be fucking easy. Easy things should be easy and complicated things possible.
I tried docker for mac, hoping that it would inherit my /etc/hosts
file. And yes. it did!. Al my containers did now inherit the hosts in /etc/hosts
I’ll come back in 3 weeks to see if I’m still happy :)
If you use pow, make sure to kill it before using the ingress on docker for mac
Another headache was me trying to get NGINX-ingress working on docker for mac kubernetes. Since i had pow.cx installed, it had a firewall route to route port 80 and 443 to a different endpoint. Therefore all my systems said NGINX was running, but yet my traffic didn’t arrive at that port. It drove me crazy. I love pow, but this was a bit too much.
So make sure to uninstall before you go this route.
curl get.pow.cx/uninstall.sh | sh
To uninstall. What actually happens is that pow redirects your port 80 to a different port so it can run above port 80 and doesn’t need sudo privileges.
Sidenote: Kubernetes Developer Experience ain’t there yet
Kubernetes is still too clunky. It seems like it tries too much, it has a bunch of jargon an subtleties and differences. Deamonsets, Replicasets, Jobs etc. Half lingering pods, not being able to just look at your deployment and get a complete trace until you the deployment is done.
Just like docker had its problems in the beginning, with not being able to set capabilities, pid 1 issues and i dint know what, it became better over the years. Docker-compose is super fun to use, and i hope I’ll get such an experience in time with kubernetes too. Maybe I’m just dumb, but i think common use cases like deploying a set of pods, easy tracing their state and not having to kubectl get pod -n my-apps
and kubectl describe pod -n my-apps
continuously to check how things are doing would be ace.