A step-by-step guide to install and run Kubernetes on your Mac so you can develop applications locally

Instruct you to use the following tools to run and access the Kubernetes cluster on your local machine:

-Homebrew
-Docker for Mac
-Minikube
-virtualbox
-kubectl

Installation Guide

The prerequisite is that you have Homebrew installed. Homebrew is a package manager for Mac. You also need Homebrew Cask, you can install it by running brew tap caskroom/cask in the terminal after Homebrew

  1. Install Docker for Mac. Docker is used to create, manage and run our containers. It allows us to build containers that will run in Kubernetes Pods

  2. Use Homebrew to install VirtualBox for Mac. Run brew cask install virtualbox in your terminal. VirtualBox allows you to run virtual machines on your Mac (just like running Windows on macOS, except for Kubernetes clusters.)

If everything is normal so far, please skip to the third step
-A non-Homebrew VirtualBox application has been installed, which can cause problems when trying to start minikube
-If you have already installed VirtualBox, please use brew cask install virtualbox as before. You will receive a warning that confirms this statement Warning: Cask'virtualbox' is already installed. After confirmation, you can reinstall VirtualBox with Homebrew by running brew cask reinstall virtualbox
-If you happen to have VirtualBox running when you perform this operation, you may see an error message Failed to unload org.virtualbox.kext.VBoxDrv - (libkern/kext) kext is in use or retained (cannot unload)
-This is because the kernel extension used by VirtualBox was in use when the uninstallation occurred. If you scroll up in the output of this command, Warning! Found the following active VirtualBox processes: You will see a list of processes that need to be terminated below
-Kill each of them in turn by running kill first_column_number (first_column_number is the process identifier of the process)
-Now re-run brew cask reinstall virtualbox, it should succeed

  1. Kubectl is installed for Mac. This is the command line interface that allows you to interact with Kuberentes. brew install kubectl run in your terminal

  2. Install Minikube through the latest version of Installation> OSX instructions. At the time of writing, this means running the following commands in the terminal...

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.27.0/minikube-darwin-amd64 &&\
  chmod +x minikube &&\
  sudo mv minikube /usr/local/bin/

Minikube will run a Kubernetes cluster with a single node

  1. Everything should work! Use minikube start. Then run kubectl api-versions. If you see the version list, everything is ok! minikube start may take a few minutes

At this point, I received an error message, Error starting host: Error getting state for host: machine does not exist. Because I have tried to run Minikube before. You can solve this problem by running open ~/.minikube/ to open the data file of Minikube, and then deleting and deleting the machines directory. Then minikube start runs again

点赞(0)

评论列表 共有 0 评论

暂无评论

微信服务号

微信客服

淘宝店铺

support@elephdev.com

发表
评论
Go
顶部