Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ryanj/329327830a5e537b55d5d359a013f04a to your computer and use it in GitHub Desktop.
Save ryanj/329327830a5e537b55d5d359a013f04a to your computer and use it in GitHub Desktop.
Local Kubernetes Environments with minikube http://bit.ly/k8s-minikube
<section data-transition='concave'>
<section id='local-kubernetes-environments-with-minikube'>
<a href="https://github.com/kubernetes/minikube"><img style="width:30%;" src="https://raw.githubusercontent.com/kubernetes/minikube/master/logo/logo.png" /></a>
<h2>Local Kubernetes Environments</h2>
<h3>with <a href="https://github.com/kubernetes/minikube"><code>minikube</code></a></h3>
<br/>
<h4 class='fragment grow'><a href="http://bit.ly/k8s-minikube"><code>bit.ly/k8s-minikube</code></a></h4>
</section>
<section data-background-transition='fade' data-background='black' id='presented-by-ryanj'>
<p>presented by <a href="http://twitter.com/ryanj/">@ryanj</a>, Developer Advocate at <a href='http://redhat.com' style='color:red;'>Red Hat</a></p>
<p><a href="http://twitter.com/ryanj/"><img alt="ryanj" src="http://ryanjarvinen.com/images/ryanj-mestrefungo-com.gif" style="width:50%" /></p>
</section>
</section>
<section data-transition='concave' id='overview' data-markdown>
### Single-Node Kubernetes
## with minikube
To run minikube on your laptop, you'll need to install:
1. [kubectl](#/kubectl)
2. [minikube](#/minikube)
3. [docker](#/docker)
<!-- 4. [Optional tooling for advanced users](#/go) -->
</section>
<section id='kubectl'>
<h3>Install <code>kubectl</code></h3>
<p>Installation on linux/amd64:</p>
<pre><code contenteditable>curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
</code></pre>
<p>Installation on macOS:</p>
<pre><code contenteditable>curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
</code></pre>
<p>For other platforms, consult the upstream <a href="https://kubernetes.io/docs/tasks/tools/install-kubectl/"><code>kubectl</code> install doc</a></p>
<br/>
<p>To verify <code>kubectl</code> availability, try running:</p>
<pre><code contenteditable>kubectl help</code></pre>
</section>
<section id='minikube'>
<h3>Install <code>minikube</code></h3>
<p>Installation on linux/amd64:</p>
<pre><code contenteditable>curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/</code></pre>
<p>Installation on macOS:</p>
<pre><code contenteditable>curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/</code></pre>
<p>For other platforms, see the <a href="https://github.com/kubernetes/minikube/releases"><code>minikube</code> release notes</a></i></p>
<p>Optionally, customize your cluster's memory or cpu allocation:</p>
<pre><code contenteditable>minikube config set memory 4096
minikube config set cpus 2</code></pre>
<p>to verify <code>minikube</code> availability:</p>
<pre><code contenteditable>minikube version</code></pre>
</section>
<section id='minikube-basics' markdown>
<h2>Minikube Basics</h2>
<p><code>minikube</code> provides an easy way to run Kubernetes locally:</p>
<pre><code contenteditable>minikube start</code></pre>
<p>When you are done, halt the VM to free up system resources:</p>
<pre><code contenteditable>minikube stop</code></pre>
<p>Need a fresh start? Delete your VM instance with:</p>
<pre><code contenteditable>minikube delete</code></pre>
</section>
<section id='minikube-virt'>
<h4>Minikube troubleshooting</h4>
<p>If your minikube environment does not boot correctly:</p>
<ol>
<li>Minikube requires an OS virtualization back-end</li>
<li>Most OSes include some support for virtualization</li>
<li>You can use the <a href="https://github.com/kubernetes/minikube#quickstart"><code>--vm-driver</code></a> flag to select a specific virt provider</li>
</ol>
<pre><code contenteditable>minikube start --vm-driver=virtualbox</code></pre>
<p>Check the project <a href="https://github.com/kubernetes/minikube#requirements"><code>README</code></a> for more information about <a href="https://github.com/kubernetes/minikube/blob/master/docs/drivers.md">supported virtualization plugins</a></p>
</section>
<!--
<section id='minikube-crio'>
<h5><b>ADVANCED CHALLENGE OPTION</b></h5>
<h3>crio-powered minikube (optional)</h3>
<p>To start <code>minikube</code> with <code>crio</code> enabled, try:</p>
<pre><code contenteditable>minikube start --network-plugin=cri --container-runtime=crio</code></pre>
<p>to verify:</p>
<pre><code contenteditable>minikube ssh
docker ps</code></pre>
<p>Running pods (and other k8s infrastructure components) would normally be visible in the output from <code>docker ps</code></p>
</section>
<section id='minikube-rkt'>
<h5><b>ADVANCED CHALLENGE OPTION</b></h5>
<h3>rkt-powered minikube (optional)</h3>
<p>To start <code>minikube</code> with <code>rkt</code> enabled, try:</p>
<pre><code contenteditable>minikube start --network-plugin=cni --container-runtime=rkt</code></pre>
<p>to verify:</p>
<pre><code contenteditable>minikube ssh
docker ps # expect no containers here
rkt list # list running containers</code></pre>
</section>
-->
<section id='docker'>
<h3>Install docker</h3>
<p>Use your package manager, or download a release from <a href="https://store.docker.com/search?offering=community&type=edition">Docker</a></p>
<pre><code contenteditable>brew cask install docker
dnf install docker
apt-get install docker</code></pre>
<br/>
<p>To verify <code>docker</code> availability, run:</p>
<pre><code contenteditable>docker version</code></pre>
</section>
<!--
<section id='go'>
<h5><b>ADVANCED CHALLENGE OPTION</b></h5>
<h3>install go (optional)</h3>
<p>Download and install binary from <a href="https://golang.org/doc/install">golang.org</a></p>
<p>Or, use a package manager to install:</p>
<pre><code contenteditable>brew install go
export GOPATH=$HOME/src/go
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin</code></pre>
<p>To verify <code>go</code> availability:</p>
<pre><code contenteditable>go version</code></pre>
</section>
-->
<section data-transition='zoom-in convex-out' id='ready'>
<h1><i>Ready?</i></h1>
<br/>
<div class='fragment fade-up'>
<p>Verify that your local Kubernetes environment is ready by running:<br/>
<pre><code contenteditable>kubectl version</code></pre>
<p>The output should include your <code>kubectl</code> version info, and the release version of the kubernetes API server (when available)</p>
</div>
</section>
<section data-transition='concave' id='next-steps'>
<h3>Congratulations on completing:</h3>
<p>
<a href="http://bit.ly/k8s-minikube">
<b>Local Kubernetes Environments with <code>minikube</code></b>
<h5 class='fragment grow'><code>bit.ly/k8s-minikube</code></h5>
</a>
</p>
<br/>
<h4><i>Next Steps</i></h4>
<p>Continue learning with other <a href="http://bit.ly/k8s-workshops"><code>k8s-workshops</code></a>:</p>
<ol>
<li><a href="http://bit.ly/k8s-kubectl"><b>Kubernetes Command-Line Basics with <code>kubectl</code></b><br/>bit.ly/k8s-kubectl</a></li>
<li><a href="http://bit.ly/k8s-miniarch"><b>Kubernetes Architecture (adapted for <code>minikube</code>)</b><br/>bit.ly/k8s-miniarch</a></li>
<li><a href="http://bit.ly/k8s-minidev"><b>Local Development with <code>minikube</code></b><br/><span style='font-size:smaller;'>bit.ly/k8s-minidev</span></a></li>
<!-- <li><a href="http://bit.ly/operatorpattern"><b>Extending Kubernetes with the Operator Pattern</b><br/><span style='font-size:smaller;'>bit.ly/operatorpattern</span></a></li> -->
</ol>
</section>
@fredhsu
Copy link

fredhsu commented May 30, 2017

On line 54 the example gives k8s version 1.6.4, but from what I can tell minikube (and k8s) doesn't have a 1.6.4?

❯ minikube get-k8s-versions                                  
The following Kubernetes versions are available: 
	- v1.7.0-alpha.2
	- v1.6.3
	- v1.6.0
	- v1.6.0-rc.1
	- v1.6.0-beta.4
	- v1.6.0-beta.3
	- v1.6.0-beta.2
	- v1.6.0-alpha.1
	- v1.6.0-alpha.0
	- v1.5.3
	- v1.5.2
	- v1.5.1
	- v1.4.5
	- v1.4.3
	- v1.4.2
	- v1.4.1
	- v1.4.0
	- v1.3.7
	- v1.3.6
	- v1.3.5
	- v1.3.4
	- v1.3.3
	- v1.3.0

@ryanj
Copy link
Author

ryanj commented Jul 26, 2017

Local Development with Minikube:

  • Build and Deploy
  • live development workflows
  • packaging and distribution
  • Continue (link back to menu / landing page)

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