<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Scott Haines</title>
    <description>The latest articles on DEV Community by Scott Haines (@newfront).</description>
    <link>https://dev.to/newfront</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F327345%2Fe833ffaa-509e-4d49-98da-ef1c28d6f779.jpg</url>
      <title>DEV Community: Scott Haines</title>
      <link>https://dev.to/newfront</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/newfront"/>
    <language>en</language>
    <item>
      <title>The Basics of Minikube</title>
      <dc:creator>Scott Haines</dc:creator>
      <pubDate>Tue, 09 Nov 2021 17:58:24 +0000</pubDate>
      <link>https://dev.to/newfront/the-basics-of-minikube-3b8c</link>
      <guid>https://dev.to/newfront/the-basics-of-minikube-3b8c</guid>
      <description>&lt;h2&gt;
  
  
  What is Minikube?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://minikube.sigs.k8s.io/docs/start/" rel="noopener noreferrer"&gt;Minikube&lt;/a&gt; is a simple to use &lt;em&gt;local virtual environment&lt;/em&gt; (and simple &lt;code&gt;shell&lt;/code&gt;) that runs a small, dedicated &lt;a href="https://kubernetes.io/" rel="noopener noreferrer"&gt;Kubernetes&lt;/a&gt; cluster locally on (Mac/Windows/Linux). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb3qtz3r2s520p57bw7zd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb3qtz3r2s520p57bw7zd.png" alt="photo credit: https://kubernetes.io/" width="800" height="647"&gt;&lt;/a&gt;&lt;br&gt;
Figure 1-1. Minikube Local Environment&lt;/p&gt;

&lt;p&gt;Installation instructions are &lt;a href="https://minikube.sigs.k8s.io/docs/start/" rel="noopener noreferrer"&gt;available online&lt;/a&gt;, or you can use &lt;code&gt;brew install minikube&lt;/code&gt;, if you are running on MacOS.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Basics
&lt;/h2&gt;

&lt;p&gt;Once installed there are only a small handful of commands needed to operate minikube effectively. The following commands can be run in your terminal of choice.&lt;/p&gt;
&lt;h2&gt;
  
  
  minikube start
&lt;/h2&gt;

&lt;p&gt;Simply spins up a local single-node Kubernetes cluster and downloads and installs any additional dependencies on your behalf.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube start
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By default, the minikube virtual machine starts up with 2 (CPU) cores and 2gb of (RAM) memory. There are many options that allow you to customize your installation and specify how the K8s cluster will operate. For example, you can choose the version of K8s, the total memory to allocate to the virtual machine, as well as the number of cpu cores.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Customizing the Minikube Virtual Machine&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube start \
  --kubernetes-version v1.21.2 \
  --memory 16g \
  --cpus 4 \
  --disk-size 80g
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you are ready to stop working, you can choose to keep the virtual machine running and simply &lt;code&gt;pause&lt;/code&gt; the processes within the k8s cluster, or you can choose to fully &lt;code&gt;stop&lt;/code&gt; the cluster and reclaim your system resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  minikube pause
&lt;/h2&gt;

&lt;p&gt;Pause is a novel concept in minikube. Rather than fully shutting down your cluster, you can choose to pause (freeze) specific resources (governed by namespaces) or pause everything that is running. Pausing specific resources for example like local Kafka or Redis can help when you need to see how your applications will act when a service is lost.&lt;/p&gt;

&lt;p&gt;Pause all Pods&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube pause -A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pause Specific Pods&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube pause -n kafka,redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  minikube unpause
&lt;/h2&gt;

&lt;p&gt;Any containers paused at a prior point in time can be unpaused.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube unpause -n kafka, redis
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using &lt;code&gt;pause&lt;/code&gt; and &lt;code&gt;unpause&lt;/code&gt; can be a life saver if you have limited local system resources, and as an added benefit provides you with a simple mechanism to return to a specific environment setup, like for example how &lt;code&gt;docker compose&lt;/code&gt; is used to spin up specific runtime environments as a slice over Docker. Given Kubernetes maintains the state of the processes running within it, minikube simply snapshots things and frees up your cluster resources (within the virtual machine) when you no longer need to run a specific set of Pods and Containers. &lt;/p&gt;

&lt;h2&gt;
  
  
  minikube stop
&lt;/h2&gt;

&lt;p&gt;When you decide you want to simply stop everything and shutdown the physical virtual machine just use the stop command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minikube stop
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That concludes the quick tour of the minikube basics. Come back here if you need to revisit any of the basic commands.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: &lt;code&gt;minikube delete&lt;/code&gt; can be used to clear everything but deleting the underlying virtual machine. Use this with caution since any changes made to the underlying K8s node (minikube node) will be wiped out as well. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>tooling</category>
      <category>cheatsheet</category>
    </item>
  </channel>
</rss>
