Skip to content

Instantly share code, notes, and snippets.

@kwent
Forked from kerin/kubernetes_deis_local.md
Last active March 15, 2017 22:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwent/313000232a79af26294b072620b5f592 to your computer and use it in GitHub Desktop.
Save kwent/313000232a79af26294b072620b5f592 to your computer and use it in GitHub Desktop.
Local Kubernetes/Deis environment

Local Kubernetes / Deis environment setup (Mac edition)

  1. Install Kubernetes (minikube)

    1. Install VirtualBox or VMWare Fusion

    2. Install minikube:

       $ brew install minikube
      

      or download the latest release manually

    3. Create and start the Kubernetes VM:

       $ minikube start --vm-driver=$VM_DRIVER --disk-size=60g --memory=4096
      

      Where $VM_DRIVER is one of virtualbox or vmwarefusion. Disk size and RAM allocations should be enough to deploy a couple of typical apps, but may be overboard for a quick test.

  2. Install kubectl to interact with the cluster:

     $ curl -Lo kubectl http://storage.googleapis.com/kubernetes-release/release/v1.3.0/bin/darwin/amd64/kubectl
     $ chmod +x kubectl
     $ mv kubectl /usr/local/bin/
    
  3. Check Kubernetes cluster is running:

     $ kubectl cluster-info
     Kubernetes master is running at https://172.16.60.128:8443
     ...
    
  4. Install helm, a Kubernetes package manager

    1. Pipe the internet straight into your shell:

       $ curl -sSL https://get.helm.sh | bash
      
    2. Move the downloaded binary somewhere sensible:

       $ mv helm /usr/local/bin/
      
  5. Install Deis command line tools 1.

     	$ curl -sSL http://deis.io/deis-cli/install-v2.sh | bash
     	$ mv deis /usr/local/bin/
    
  6. Deploy Deis Workflow on Kubernetes via Helm 5. Check helm can connect to your Kubernetes cluster:

     	$ helm version
    
    1. Add the Deis 'chart' repo

       $ helm repo add deis https://charts.deis.com/workflow
      
    2. Create Deis resources in Kubernetes cluster

       $ helm install deis/workflow --namespace deis --set router.host_port.enabled=true
      
    3. Monitor Deis pods until everything has started:

       $ kubectl --namespace=deis get pods -w
      

      This watches get pods output. Once all pods are in READY state, ctrl+c to cancel and you're good to go

    4. Register a Deis admin user

       $ deis register http://deis.$(minikube ip).nip.io
      

      This uses minikube ip to get your VMs IP, and nip.io to provide wildcard DNS, so that http://appname.$IP_ADDRESS.nip.io will work

  7. Deploy a sample application 6. Create a Deis app, with no git remote

     	$ deis create --no-remote
     	Creating Application... done, created proper-barbecue
     	If you want to add a git remote for this app later, use `deis git:remote -a proper-barbecue`
     Make a note of the app name.
    
    1. Deploy a sample Go app

       $ deis pull deis/example-go -a proper-barbecue
       Creating build... done
      
    2. View your sample app

       $ curl http://proper-barbecue.$(minikube ip).nip.io
       Powered by Deis
      
    3. Try Heroku-like things:

       $ deis config:set POWERED_BY="Docker Images + Kubernetes" -a proper-barbecue
       Creating config... done
       $ curl http://proper-barbecue.$(minikube ip).nip.io
       Powered by Docker Images + Kubernetes
       
       $ deis scale cmd=2 -a proper-barbecue
       Scaling processes... but first, coffee!
       done in 36s
       === proper-barbecue Processes
       --- cmd:
       proper-barbecue-v18-cmd-rk644 up (v18)
       proper-barbecue-v18-cmd-0ag04 up (v18)
      
    4. ¯\_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment