<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DevMemo – minikube</title><link>https://devmemo.gitlab.io/categories/minikube/</link><description>Recent content in minikube on DevMemo</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://devmemo.gitlab.io/categories/minikube/index.xml" rel="self" type="application/rss+xml"/><item><title>Cheatsheets: Minikube Cheatsheet</title><link>https://devmemo.gitlab.io/cheatsheets/minikube/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://devmemo.gitlab.io/cheatsheets/minikube/</guid><description>
&lt;h2 id="installation">Installation&lt;/h2>
&lt;h3 id="prerequisite">Prerequisite&lt;/h3>
&lt;p>Install &lt;a href="https://devmemo.gitlab.io/cheatsheets/docker/">docker&lt;/a> before minikube.&lt;/p>
&lt;h3 id="install-on-linux">Install On Linux&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Install using binary.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo install minikube-linux-amd64 /usr/local/bin/minikube
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Install minikube using debian package.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube_latest_amd64.deb
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo dpkg -i minikube_latest_amd64.deb
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Install minikube using rpm package.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.x86_64.rpm
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo rpm -Uvh minikube-latest.x86_64.rpm
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="install-on-mac">Install On Mac&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Install using binary on amd64.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-amd64
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo install minikube-darwin-amd64 /usr/local/bin/minikube
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Install using binary on arm.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-darwin-arm64
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>sudo install minikube-darwin-arm64 /usr/local/bin/minikube
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Install with homebrew on either arm or amd64.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>brew install minikube
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="kubectl">Kubectl&lt;/h2>
&lt;h3 id="run-kubectl-command">Run Kubectl Command&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Run kubectl command.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube kubectl -- &amp;lt;kubectl commands&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="set-up-kubectl-alias">Set Up Kubectl Alias&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Set up kubectl alias for easy use.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>alias kubectl&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#34;minikube kubectl --&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="cluster">Cluster&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Start minikube cluster.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube start
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Pause Kubernetes without impacting deployed applications.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube pause
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Unpause a paused instance.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube unpause
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Halt the cluster.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube stop
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Delete the cluster.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube delete
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Upgrade your cluster.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube start --kubernetes-version&lt;span style="color:#f92672">=&lt;/span>latest
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Start another cluster.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube start -p cluster2
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Show the current active profile.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube profile
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># List all profiles.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube profile list
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Switch the active profile.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube profile &amp;lt;profile-name&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="addons">Addons&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># List all addons.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube addons list
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Enable an addon.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube addons enable &amp;lt;addon-name&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Enable an addon at the cluster startup time.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube start --addons &amp;lt;addon-name&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># If an addon exposes a browser endpoint, you can quickly open it with.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube addons open &amp;lt;addon-name&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Disable an addon.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube addons disable &amp;lt;addon-name&amp;gt;
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="configs">Configs&lt;/h2>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Set the memory limit (requires a restart).&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube config set memory &amp;lt;size-in-bytes&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Set the cpu limit (requires a restart).&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube config set cpus &amp;lt;number-of-cores&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Get the current config for a field (e.g., memory or cpu).&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube config &amp;lt;field-name&amp;gt;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Show the current config.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube config view
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h2 id="dashboard">Dashboard&lt;/h2>
&lt;h3 id="minikube-on-local">Minikube On Local&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Show the dashboard (if you are not using Minikube locally).&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube dashboard
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="minikube-on-remote">Minikube On Remote&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Get a dashboard url.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube dashboard --url
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Forward your port.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>minikube kubectl proxy -- --address&lt;span style="color:#f92672">=&lt;/span>&lt;span style="color:#e6db74">&amp;#39;0.0.0.0&amp;#39;&lt;/span> --disable-filter&lt;span style="color:#f92672">=&lt;/span>true
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># Then your minikube dashboard can be accessed from the following url.&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#75715e"># (The following command can run from your Mac laptop. If you are not using a Mac laptop, copy the url to your browser)&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>open &lt;span style="color:#e6db74">&amp;#34;http://{your-minikube-host-ip}:8001/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item></channel></rss>