Skip to content

Instantly share code, notes, and snippets.

@kerin
Last active March 15, 2017 21:52
Show Gist options
  • Save kerin/1fb1c003a9efceffe357e77a3404c311 to your computer and use it in GitHub Desktop.
Save kerin/1fb1c003a9efceffe357e77a3404c311 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 helmc, 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 helmc /usr/local/bin/
      
  5. Install Deis command line tools

    1. $ brew install deis

    2. ...or pipe the internet into bash again:

       $ 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:

     	$ helmc target
     	Kubernetes master is running at https://172.16.60.128:8443
     	...
    
    1. Add the Deis 'chart' repo

       $ helmc repo add deis https://github.com/deis/charts
      
    2. Fetch the chart

       $ helmc fetch deis/workflow-v2.8.0
      
    3. Generate secrets

       $ helmc generate -x manifests workflow-v2.8.0
      
    4. Create Deis resources in Kubernetes cluster

       $ helmc install workflow-v2.8.0
      
    5. 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

    6. 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