Spent two days, finally Minikube deployment success, the mood can not calm for a long time, so write an article to commemorate, incidentally remind later, avoid stepping on pit ~

background

What is Minikube?

Minikube is a tool that can run a single node Kubernetes cluster in a virtual machine, allowing developers to develop and debug Kubernetes in a local environment.

What is Kubernetes?

Kubernetes is an open source system for automatically deploying, scaling, and managing containerized applications.

What is the container?

Container refers to the process that uses virtualization technology to isolate different applications and their required running environment, among which Docker is the most famous open source container software.

How does feeling see not understand ~ am I entered wrong public number dot wrong article?

Wait ~ understand its power before closing the article.

  • I have several projects that use different versions of Node.js, and it is very inconvenient to switch between them. The virtual runtime environment of the container can be resolved

  • Dependencies need to be re-installed with each deployment, and problems can occur with different environment dependencies after installation. – Packaged as an image, no need to install dependencies, second boot.

  • I want to create several of the same processes for load balancing/high availability. Create a container copy using Kubernetes.

  • I want my process to restart automatically if it dies or gets killed in production. Use Kubernetes’ self-healing function to manipulate containers.

  • Processes are allocated according to the resource usage of different machines. Use Kubernetes to schedule containers. …

If interested can look at this simple article “your daughter also can understand the illustration edition Kubernetes guide at http://www.codeceo.com/article/kubernetes-guide.html

Installation steps

1. Enable the CPU virtualization function (Intel VT-X or AMD-V).

VT – x open private tutorial: https://jingyan.baidu.com/article/fd8044faff36a45031137a3e.html

AMD -v open private tutorial: https://zhidao.baidu.com/question/1045505232562268339.html

VMS can be created only when the CPU virtualization function is enabled, and applications can be containerized only when VMS are used. Therefore, please check whether the current CPU supports and enables virtualization technology before installation. If it is not supported, it cannot be installed. If it is not enabled, you can refer to the above two articles to enter the BIOS. After the virtualization technology is enabled, you can see “Enabled” in the performance TAB of task Manager, as shown in the following figure

2. Install VirtualBox or hyper-v (Windows8 + installed by default)

The Hyper -v create virtual machine folk tutorial: http://win8.yesky.com/275/34411775_2.shtml

Once virtualization is enabled we use it by creating virtual machines. You can use third-party VirtualBox or hyper-V that comes with Windows.

In order to keep the system pure and follow the principle of installing as little software as possible, I chose Hyper-V of course.

Enter Hyper-V and click “Hyper-V Manager” in the search result to create a virtual network switch, as shown in the following figure.

Be sure to select External network and the network card you are currently using.

The name of the switch I created is K8SvSwitch.

3. Install kubectl

Kubectl official tutorial: https://kubernetes.io/docs/tasks/tools/install-kubectl/

This step is not difficult because Kubectl is a green single file. The biggest problem is probably the download failure due to Google’s inability to access it. Have a ladder can turn qiang download, if not, you can see the download address at the end of the article. I have uploaded everything I need to download to my web disk.

After the download is complete, add the directory of the file to the environment variable so that we can execute Kubectl directly from the command line.

After the configuration, reopen a command line and type

kubectl version

The installation is complete when you see something like the following.

4. Install Minikube and start it

Install Minikube in the same way you installed Kubectl in the previous step. Download the executable file from Google, rename it minikube.exe, and add the path to the environment variable.

Are you ready to start the vm to create a cluster?

It’s always darkest before the dawn, and the last step to start is also where the most holes are.

If you install the official command minikube start, there may be various errors, and then the Internet search may appear various solutions, after experiencing various problems summarized as follows:

Minikube start uses VirtualBox by default, but we are using Hyper-V, so we need to specify:

minikube start --vm-driver=hyperv

Remember the virtual network switch we created earlier? That’s where it comes in.

minikube start --vm-driver=hyperv --hyperv-virtual-switch=k8svswitch

By default, no error information is displayed. In order to troubleshoot problems during startup, log output is enabled.

minikube start --vm-driver=hyperv --hyperv-virtual-switch=k8svswitch --v=3 --alsologtostderr

The default value is 2048Mb of memory, but if it is not enough, we need to use memory 1024 to specify a smaller amount of memory. Of course, my machine cannot run out of 10Gb of memory, this parameter is omitted

If your network has been turned over, you can open the command line with administrator privileges, type and press Enter to start.

Otherwise, you need to put the required files into the cache directory in advance.

Find the cache directory under the current user, C:\Users\ XXX \. Minikube \cache

Minikube-v0.20.0. iso into the iso directory, localkube-v1.8.0 into localkube, should have the following files:

C: \ Users \ \. XXX minikube/cache/iso/minikube - v0.20.0. Iso C: \ Users \ \. XXX minikube \ cache \ localkube \ localkube - v1.8.0Copy the code

Administrator mode open the command line and execute the above minikube start… Initial command.

After executing kubectl cluster-info dump, run kubectl cluster-info dump. If a large amount of cluster information is displayed, the installation is successful

If the above steps are still not successful, you can refer to an article by foreign netizens

The Run k8s minikube on Windows with the Hyper – 10 V, https://gibmirfred.de/2017/02/run-k8s-minikube-on-windows-10-with-hyper-v/

The attachment address

Network location to download address: https://pan.baidu.com/s/1qY3cVfu minikube v0.20.0 kubectl v1.8.0

This article may be forwarded or shared, but must retain the complete picture and text information and source, the author reserves the right to investigate all legal responsibility and means ~

Search the concerned public account “Web Learning Club”