Using Minikube (Kubernetes) for local Node.js development

$echo `whoami`

We have a problem

Developer Excuses 

  • My code is compiling

  • That person doesn't work here anymore

  • That's a feature

  • That's the way we've always done it

Best developer excuse

Just one problem..

Something helped with that

  • Isolate apps in containers 

  • Package deps in your app

  • Run, build, ship anywhere 

  • No more, it works on my machine

Wait, no my workflow is....

  • Make app

  • Blame devops

  • Profit

New problem

  • Build your app

  • Run local and integration tests

  • Ops team uses tool to publish new docker image

  • Ops team comes back and says it doesn't work

Kubernetes (k8s) is an open-source system for automating deployment, scaling, and management of containerized applications.

Another problem

Difficult to set up

  • kube-up.sh (deprecated)
  • kops
  • kube-aws (CoreOS)

Commitment to cloud provider

Google Cloud

AWS

Microsoft

I can use docker locally, can I use Kubernetes locally?

Minikube is a tool that makes it easy to run Kubernetes locally

  •  Single-node Kubernetes cluster inside a VM on your computer
  • Allows you to use kubectl to access cluster for development purposes
  • Test strategies on you computer instead of in the cloud
  •     kubectl
    • https://kubernetes.io/docs/tasks/tools/install-kubectl/
  •     macOS
    •     xhyve driver, VirtualBox or VMware Fusion
  •     Linux
    •     VirtualBox or KVM
  •     Windows
    •     VirtualBox or Hyper-V
  •     VT-x/AMD-v virtualization must be enabled in BIOS
  •     Internet connection on first run

What you will need

  • macOS
    • brew install minikube
  • Linux
    • curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin
  • Windows    
    • https://storage.googleapis.com/minikube/releases/latest/minikube-windows-amd64.exe
    • rename file to minikube.exe and add it to your path

Installing Minikube

  • It can’t expose your application on type LoadBalancer
    •     – Kubernetes allows you to do this with the cloud provider but not locally, so you must expose your application with NODEPORT
  • It can not help you convince your boss that you need a raise because of your new devOPS skills
  • Use upgraded docker version outside of what minikube provides version 0.21 uses docker version 1.12 (Server)

What Minikube can't do

Project that I will demonstrate 

Fixit Vancouver

https://github.com/troy0820/fixit-vancouver

This is what I did before we start this demo….

 

  • I’m using minikube version 0.21
  • minikube start
  • minikube docker-env
  • eval $(minikube docker-env)
  • Downloaded images that I need ahead of time
  • Using local docker images to use in your Minikube cluster
  • Deploying those local images to your Minikube cluster
  • Making replicaSets, healthChecks, autoscaling, dashboard, minikube services
  • Using Ingress to expose multiple applications without using multiple LoadBalancers, in our case NODEPORTS

Demo Time

Made with Slides.com