Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Local Kubernetes Environments with minikube
<section data-transition='concave'>
<section id='local-kubernetes-environments-with-minikube'>
<a href=""><img style="width:30%;" src="" /></a>
<h2>Local Kubernetes Environments</h2>
<h3>with <a href=""><code>minikube</code></a></h3>
<h4 class='fragment grow'><a href=""><code></code></a></h4>
<section data-background-transition='fade' data-background='black' id='presented-by-ryanj'>
<p>presented by <a href="">@ryanj</a>, Developer Advocate at <a href='' style='color:red;'>Red Hat</a></p>
<p><a href=""><img alt="ryanj" src="" style="width:50%" /></p>
<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 id='kubectl'>
<h3>Install <code>kubectl</code></h3>
<p>Installation on linux/amd64:</p>
<pre><code contenteditable>curl -LO$(curl -s && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
<p>Installation on macOS:</p>
<pre><code contenteditable>curl -LO$(curl -s && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
<p>For other platforms, consult the upstream <a href=""><code>kubectl</code> install doc</a></p>
<p>To verify <code>kubectl</code> availability, try running:</p>
<pre><code contenteditable>kubectl help</code></pre>
<section id='minikube'>
<h3>Install <code>minikube</code></h3>
<p>Installation on linux/amd64:</p>
<pre><code contenteditable>curl -Lo minikube && chmod +x minikube && sudo mv minikube /usr/local/bin/</code></pre>
<p>Installation on macOS:</p>
<pre><code contenteditable>curl -Lo minikube && chmod +x minikube && sudo mv minikube /usr/local/bin/</code></pre>
<p>For other platforms, see the <a href=""><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 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 id='minikube-virt'>
<h4>Minikube troubleshooting</h4>
<p>If your minikube environment does not boot correctly:</p>
<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=""><code>--vm-driver</code></a> flag to select a specific virt provider</li>
<pre><code contenteditable>minikube start --vm-driver=virtualbox</code></pre>
<p>Check the project <a href=""><code>README</code></a> for more information about <a href="">supported virtualization plugins</a></p>
<section id='minikube-crio'>
<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 id='minikube-rkt'>
<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 id='docker'>
<h3>Install docker</h3>
<p>Use your package manager, or download a release from <a href="">Docker</a></p>
<pre><code contenteditable>brew cask install docker
dnf install docker
apt-get install docker</code></pre>
<p>To verify <code>docker</code> availability, run:</p>
<pre><code contenteditable>docker version</code></pre>
<section id='go'>
<h3>install go (optional)</h3>
<p>Download and install binary from <a href=""></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 data-transition='zoom-in convex-out' id='ready'>
<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>
<section data-transition='concave' id='next-steps'>
<h3>Congratulations on completing:</h3>
<a href="">
<b>Local Kubernetes Environments with <code>minikube</code></b>
<h5 class='fragment grow'><code></code></h5>
<h4><i>Next Steps</i></h4>
<p>Continue learning with other <a href=""><code>k8s-workshops</code></a>:</p>
<li><a href=""><b>Kubernetes Command-Line Basics with <code>kubectl</code></b><br/></a></li>
<li><a href=""><b>Kubernetes Architecture (adapted for <code>minikube</code>)</b><br/></a></li>
<li><a href=""><b>Local Development with <code>minikube</code></b><br/><span style='font-size:smaller;'></span></a></li>
<!-- <li><a href=""><b>Extending Kubernetes with the Operator Pattern</b><br/><span style='font-size:smaller;'></span></a></li> -->

This comment has been minimized.

Copy link

@fredhsu 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

This comment has been minimized.

Copy link
Owner Author

@ryanj 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