{"id":924,"date":"2023-06-23T05:43:25","date_gmt":"2023-06-23T05:43:25","guid":{"rendered":"https:\/\/blog.ngocha.biz\/?p=924"},"modified":"2023-06-23T05:43:25","modified_gmt":"2023-06-23T05:43:25","slug":"minikube-mac","status":"publish","type":"post","link":"https:\/\/blog.ngocha.biz\/?p=924","title":{"rendered":"How to Setup Minikube on MAC M1\/M2"},"content":{"rendered":"<p>This blog contains the guide to setting up a working Minikube cluster on MAC M1\/M2 arm64 systems using the Qemu emulator as the backend driver.<\/p>\n<p>Qemu emulator is the best option to run a <a href=\"https:\/\/devopscube.com\/setup-kubernetes-cluster-kubeadm\/\">Kubernetes Cluster<\/a> using minikube on MAC arm64-based systems without any issues. All other setups like <a href=\"https:\/\/devopscube.com\/what-is-docker\/\">Docker<\/a>, <a href=\"https:\/\/devopscube.com\/podman-tutorial-beginners\/\">Podman<\/a>, and <a href=\"https:\/\/devopscube.com\/virtual-box-tutorial\/\">Virtualbox<\/a> run into some sort of issue.<\/p>\n<h2 id=\"setup-minikube-on-mac-m1m2\">Setup Minikube on MAC M1\/M2<\/h2>\n<p><strong>Step 1:<\/strong> Install Qemu<\/p>\n<p>Install the Qemu emulator using the following command.<\/p>\n<pre><code>brew install qemu<\/code><\/pre>\n<p><strong>Step 2:<\/strong> Setup Qemu socket_vvmnet<\/p>\n<p>For minikube service URLs to work, you need to start the socket_vmnet service<\/p>\n<pre><code>brew install socket_vmnet\nbrew tap homebrew\/services\nHOMEBREW=$(which brew) &amp;&amp; sudo ${HOMEBREW} services start socket_vmnet<\/code><\/pre>\n<p><strong>Step 3:<\/strong> Install minikube<\/p>\n<pre><code>brew install minikube<\/code><\/pre>\n<p><strong>Step 4: <\/strong>Start Minikube with the Qemu driver and <strong><code>socket_vmnet<\/code><\/strong><\/p>\n<pre><code>minikube start --driver qemu --network socket_vmnet<\/code><\/pre>\n<p>On successful execution, you should see the below output.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-27-23.png\" class=\"kg-image\" alt=\"\" loading=\"lazy\" width=\"1088\" height=\"402\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-27-23.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w1000\/2025\/03\/image-27-23.png 1000w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-27-23.png 1088w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<h2 id=\"validate-minikube-setup\">Validate Minikube Setup<\/h2>\n<div class=\"kg-card kg-callout-card kg-callout-card-grey\">\n<div class=\"kg-callout-text\"><b><strong style=\"white-space: pre-wrap;\">Note:<\/strong><\/b> Ensure you have kubectl installed on your workstation.<\/div>\n<\/div>\n<p>To validate the setup let&#8217;s deploy a sample nginx application with a NodePort service. So that we can validate pod deployment as well as network access using the NodePort service.<\/p>\n<p>Execute the following kubernetes manifest to deploy nginx deployment and a Nodeport service<\/p>\n<pre><code>cat &lt;&lt;EOF | kubectl apply -f -\napiVersion: v1\nkind: Service\nmetadata:\n  name: web-service\nspec:\n  ports:\n  - name: http\n    port: 80\n  selector:\n    app: web\n  type: NodePort\n---\napiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: web-deployment\nspec:\n  replicas: 2\n  selector:\n    matchLabels:\n      app: web\n  template:\n    metadata:\n      labels:\n        app: web\n    spec:\n      containers:\n      - image: nginx:1.14.2\n        name: nginx\n        ports:\n        - containerPort: 80\nEOF<\/code><\/pre>\n<p>Validate the deployment and service<\/p>\n<pre><code>kubectl get all<\/code><\/pre>\n<p>You should see an output as shown below.<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-25-25.png\" class=\"kg-image\" alt=\"Validate Minikube Setup on MAC M1\/M2\" loading=\"lazy\" width=\"989\" height=\"430\" srcset=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/size\/w600\/2025\/03\/image-25-25.png 600w, https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-25-25.png 989w\" sizes=\"auto, (min-width: 720px) 720px\"><\/figure>\n<p>To validate the networking, get the service URL using the following command. It will give you the node IP with NodePort in URL format.<\/p>\n<pre><code>minikube service web-service --url<\/code><\/pre>\n<p>Access the URL and you should be able to view the Nginx home page as shown below<\/p>\n<figure class=\"kg-card kg-image-card\"><img decoding=\"async\" src=\"https:\/\/storage.ghost.io\/c\/5f\/2f\/5f2f4d20-2abf-4534-8d40-7aa233aedd43\/content\/images\/2025\/03\/image-26-23.png\" class=\"kg-image\" alt=\"\" loading=\"lazy\" width=\"556\" height=\"242\"><\/figure>\n<h2 id=\"minikube-qemu-issues-issues\">Minikube Qemu Issues Issues<\/h2>\n<p>If you don&#8217;t have socket_vmnet running with Qemu and if you try to access Minikube service URLs, you will get the following error.<\/p>\n<p>To rectify this, install the socket_vmnet using the commands given in step 2 under the setup guide.<\/p>\n<pre><code>\u274c  Exiting due to MK_UNIMPLEMENTED: minikube service is not currently implemented with the builtin network on QEMU, try starting minikube with '--network=socket_vmnet'<\/code><\/pre>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>If you are new to Minikube, check out my <a href=\"https:\/\/devopscube.com\/kubernetes-minikube-tutorial\/\">Minikube tutorial <\/a>where I have added all the required steps to get you started with a development Kubernetes cluster.<\/p>\n<p>If you are learning Kubernetes, check out the <a href=\"https:\/\/devopscube.com\/learn-kubernetes-complete-roadmap\/\">Kubernetes learning path<\/a> and <a href=\"https:\/\/devopscube.com\/kubernetes-tutorials-beginners\/\">Kubernetes tutorials for beginners.<\/a><\/p>\n<hr>\n<p><strong>Ngu\u1ed3n:<\/strong> <a href=\"https:\/\/devopscube.com\/minikube-mac\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to Setup Minikube on MAC M1\/M2 \u2014 DevOpsCube<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Source: https:\/\/devopscube.com\/minikube-mac\/<\/p>\n","protected":false},"author":1,"featured_media":925,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-924","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops"],"_links":{"self":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/924","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=924"}],"version-history":[{"count":0,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/posts\/924\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=\/wp\/v2\/media\/925"}],"wp:attachment":[{"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=924"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=924"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ngocha.biz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=924"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}