preface

Recently, I participated in the implementation of PASS platform in the internship unit, and I got to know a lot of new knowledge points. I took a break from busy work and planned to learn about containers.

First of all, for daily development and use, I do not recommend to install a virtual machine under the Win10 system, then install Linux, and then install Docker inside. It can be said that the emergence of traditional virtual machines enables multiple applications to play an isolated role when deployed in the same server. Docker and other technologies are the further development of virtual machines. We can use container technology directly on Windows, Mac, or Linux. Follow its platform independence.

Step 1 Install Docker Desktop

1.1 Select an installation source and download it

If your computer is lenovo brand, then you can manage the installation through lenovo Computer Manager software.

If not, you can download the installation package from the official website

Hub.docker.com/editions/co…

You need to enable Hyper-V before installation. After installation, you can configure the location of the virtual hard drive docker mounts in Hyper-V. By default, it is on drive C, which is not a good choice. If your computer supports WSL, you can also install Docker in WSL.

1.2 Checking whether the installation is successful

Start docker Desktop and run Docker Version on the terminal to test whether Docker is successfully installed. If the output version number is displayed, it proves that docker is correctly installed

1.3 Modifying the Image Source Configuration

Start docker and change it to a domestic mirror source

Two mirror sources are provided

{
  "registry-mirrors": [
    "https://ustc-edu-cn.mirror.aliyuncs.com/"."https://hub-mirror.c.163.com/"]."insecure-registries": []."debug": true."experimental": false
}
Copy the code

If the configuration is performed in CentOS, the configuration is performed in /etc/docker-daemon. json

vim /etc/docker/deamon.json

#Add the following
{
    "registry-mirrors": [
    	"http://hub-mirror.c.163.com",
    	"https://ustc-edu-cn.mirror.aliyuncs.com/"]
}

#And then restart the service
systemctl restart docker.service
Copy the code

Step 2 Install the minikube tool

Minikube is a tool that allows you to easily run Kubernetes locally. Minikube runs a single-node Kubernetes cluster in a virtual machine (VM) on a laptop for users who want to try Kubernetes or do routine development.

2.1 Environment Requirements

  • Two or more cpus
  • 2GB of available memory
  • 20GB of available disk space
  • Internet connection
  • Container or virtual machine manager, such as Docker

2.2 Download and Installation

Download link

One tip is that you need to run the installation program as an administrator, and once it’s installed, you can configure the installation directory into the environment variable Path for more user-friendly use

2.3 start

If you have configured the environment variables, you can run the minikebe start command directly from the terminal, which will download the image and create a single-node K8S cluster.

2.4 Entering a Node

Run the minikube SSH command to log in to the cluster environment

You can then use Docker PS to view the running container instance

After exiting, run the minikube dashboard command to open the Kubernetes dashboard

Step 3: Install Kubectl

3.1 Download and Installation

Kubectl is a command line tool for K8S that allows you to deploy applications, check and manage cluster resources, and view logs.

Download link (this link (storage.googleapis.com))

Verify the installed version with Kubectl version –client

3.2 Verifying the Configuration

Kubectl needs a configuration file to access the cluster correctly, which can be verified by using the command kubectl cluster-info to get cluster information.

The KubeconFig configuration file is automatically generated when you use kube-up.sh to create a Kubernetes cluster or use an already deployed Minikube cluster.

As you can see, the Kubectl configuration is successful.