简体   繁体   English

了解 Minikube 在 Windows 上的运行方式

[英]Understand how Minikube on Windows is run

I am trying to understand how Minikube is run on Windows, for the following setup.我试图了解 Minikube 如何在 Windows 上运行,以进行以下设置。 There are several related questions below, which I hope will help me understand holistically how this works.下面有几个相关的问题,我希望它们能帮助我从整体上理解这是如何工作的。

Using minikube profile list, I get the following output.使用 minikube 配置文件列表,我得到以下输出。

C:\>minikube profile list
|----------|-----------|---------|--------------|------|---------|---------|-------|
| Profile  | VM Driver | Runtime |      IP      | Port | Version | Status  | Nodes |
|----------|-----------|---------|--------------|------|---------|---------|-------|
| minikube | docker    | docker  | 192.168.49.2 | 8443 | v1.20.7 | Running |     1 |
|----------|-----------|---------|--------------|------|---------|---------|-------|

Is this minikube a container running using my local installation of Docker Desktop?这个 minikube 是使用我本地安装的 Docker Desktop 运行的容器吗? Thus whether it runs on WSL2 or Virtualbox is dependent on how I get my Docker Desktop run?因此,它是在 WSL2 还是 Virtualbox 上运行取决于我如何运行 Docker 桌面?

If I minikube ssh, I get to interact with docker within.如果我使用 minikube ssh,我可以在里面与 docker 交互。 From the output below, does it mean that each of the minikube kubernetes component is run as an individual container?从下面的输出中,是否意味着每个 minikube kubernetes 组件都作为单独的容器运行? Is this an example of docker-in-docker?这是 docker-in-docker 的一个例子吗?

C:\>minikube ssh
Last login: Wed Nov 10 14:07:23 2021 from 192.168.49.1
docker@minikube:~$ docker ps --format '{{.Names}}'
k8s_storage-provisioner_storage-provisioner_kube-system_b7c766e9-48fe-45dd-a929-d6fd4b6fcf8b_0
k8s_POD_storage-provisioner_kube-system_b7c766e9-48fe-45dd-a929-d6fd4b6fcf8b_0
k8s_kube-proxy_kube-proxy-4r5hz_kube-system_71dc0877-5a47-4b2c-a106-ee41e5f6a142_0
k8s_coredns_coredns-74ff55c5b-pl7tb_kube-system_6cf31402-c3b4-4d86-8963-8a53e36b7878_0
k8s_POD_kube-proxy-4r5hz_kube-system_71dc0877-5a47-4b2c-a106-ee41e5f6a142_0
k8s_POD_coredns-74ff55c5b-pl7tb_kube-system_6cf31402-c3b4-4d86-8963-8a53e36b7878_0
k8s_kube-scheduler_kube-scheduler-minikube_kube-system_82ed17c7f4a56a29330619386941d47e_0
k8s_kube-apiserver_kube-apiserver-minikube_kube-system_01d7e312da0f9c4176daa8464d4d1a50_0
k8s_kube-controller-manager_kube-controller-manager-minikube_kube-system_c7b8fa13668654de8887eea36ddd7b5b_0
k8s_etcd_etcd-minikube_kube-system_c31fe6a5afdd142cf3450ac972274b36_0
k8s_POD_kube-scheduler-minikube_kube-system_82ed17c7f4a56a29330619386941d47e_0
k8s_POD_kube-controller-manager-minikube_kube-system_c7b8fa13668654de8887eea36ddd7b5b_0
k8s_POD_kube-apiserver-minikube_kube-system_01d7e312da0f9c4176daa8464d4d1a50_0
k8s_POD_etcd-minikube_kube-system_c31fe6a5afdd142cf3450ac972274b36_0
docker@minikube:~$

Is a minikube container using the local installation of Docker Desktop? minikube容器是使用本地安装的 Docker Desktop 吗?

Minikube is local Kubernetes, focusing on making it easy to learn and develop for Kubernetes. Minikube 是本地 Kubernetes,专注于让 Kubernetes 易于学习和开发。 All you need is Docker (or similarly compatible) container or a Virtual Machine environment, and Kubernetes is a single command away: minikube start.您所需要的只是 Docker(或类似兼容的)容器或虚拟机环境,而 Kubernetes 只需一个命令:minikube start。

What you'll need?你需要什么?

  • 2 CPUs or more 2 个或更多 CPU
  • 2GB of free memory 2GB 可用内存
  • 20GB of free disk space 20GB 可用磁盘空间
  • Internet connection网络连接
  • Container or virtual machine manager, such as: Docker, Hyperkit, Hyper-V, KVM, Parallels, Podman, VirtualBox, or VMware容器或虚拟机管理器,例如:Docker、Hyperkit、Hyper-V、KVM、Parallels、Podman、VirtualBox 或 VMware

I want to point out the last sentence, you can choose from multiple containers or virtual machine managers.我想指出最后一句话,您可以从多个容器或虚拟机管理器中进行选择。 Docker is one of the options you could have chosen, and based on your post,your current deployment is using Docker as hypervisor. Docker 是您可以选择的选项之一,根据您的帖子,您当前的部署使用 Docker 作为管理程序。

Is it running on WSL2 or Virtualbox?它是在 WSL2 还是 Virtualbox 上运行的?

Here is some information about WSL2 and Virtualbox, but the information provided about your environment is not enough to determine if your deployment is in Virtualbox or WSL2.以下是有关 WSL2 和 Virtualbox 的一些信息,但提供的有关您的环境的信息不足以确定您的部署是在 Virtualbox 还是 WSL2 中。

Virtualbox hardware virtualization option is to allow the virtualization capabilities provided by the processor. Virtualbox硬件虚拟化选项是允许处理器提供的虚拟化功能。 This does not help with nested virtualization.这对嵌套虚拟化没有帮助。 You can run in Docker in Virtualbox as long as there is no hypervisor running inside.只要里面没有运行管理程序,你就可以在 Virtualbox 的 Docker 中运行。 That is the case when we run Docker on Linux systems in Virtualbox.当我们在 Virtualbox 的 Linux 系统上运行 Docker 时就是这种情况。 With Windows server, they run hyperv as well on top of which they run Windows server where Docker runs.使用 Windows 服务器,他们也运行 hyperv,并在其上运行运行 Docker 的 Windows 服务器。 That's why nested virtualization is needed here.这就是为什么这里需要嵌套虚拟化的原因。

With Docker Desktop running on WSL 2 , users can leverage Linux workspaces and avoid having to maintain both Linux and Windows build scripts.通过在WSL 2上运行 Docker Desktop,用户可以利用 Linux 工作区并避免同时维护 Linux 和 Windows 构建脚本。 In addition, WSL 2 provides improvements to file system sharing, boot time, and allows access to some cool new features for Docker Desktop users.此外,WSL 2 改进了文件系统共享、启动时间,并允许 Docker 桌面用户访问一些很酷的新功能。

Before you install the Docker Desktop WSL 2 backend, you must complete the following steps:在安装 Docker Desktop WSL 2 后端之前,您必须完成以下步骤:

  • Install Windows 10, version 1903 or higher or Windows 11.安装 Windows 10 版本 1903 或更高版本或 Windows 11。
  • Enable WSL 2 feature on Windows.在 Windows 上启用 WSL 2 功能。
  • Download and install the Linux kernel update package.下载并安装 Linux 内核更新包。

Does each of the minikube kubernetes components run as an individual container?每个 minikube kubernetes 组件都作为单独的容器运行吗?

Minikube is a utility you can use to run Kubernetes on your local machine. Minikube 是一个可用于在本地机器上运行 Kubernetes 的实用程序。 It creates a single node cluster contained in a virtual machine (VM).它创建一个包含在虚拟机 (VM) 中的单节点集群。 This cluster lets you demo Kubernetes operations without requiring the time and resource-consuming installation of full-blown K8s.该集群可让您演示 Kubernetes 操作,而无需安装成熟的 K8s 所需的时间和资源。

Here are the basic concepts of kubernetes .下面是kubernetes基本概念

Deployment—configured and operational resources.部署——配置和操作的资源。 Deployments are the overall processes that enable you to orchestrate your resources.部署是使您能够编排资源的整体过程。

ReplicaSet—sets of pods that provide the resources for your services. ReplicaSet — 为您的服务提供资源的 Pod 集。

Pod—a unit that contains one or more containers along with attached storage resources, and configuration definitions. Pod——包含一个或多个容器以及附加存储资源和配置定义的单元。 Pods are grouped together in ReplicaSets and all pods in a set run the same container images. Pod 在 ReplicaSet 中分组在一起,并且集合中的所有 Pod 都运行相同的容器映像。

Node cluster—control plane and worker nodes that each contain one or more pods.节点集群——控制平面和工作节点,每个节点都包含一个或多个 Pod。 The workers run your workloads and the control plane orchestrates the workers together.工作人员运行您的工作负载,控制平面将工作人员编排在一起。 This is what Minikube creates.这就是 Minikube 创建的。

Node processes—the various components that you use to connect and manage Kubernetes.节点进程——用于连接和管理 Kubernetes 的各种组件。 Control plane processes include API servers, ectd, Scheduler, kube-controller-manager, and cloud-controller-manager.控制平面进程包括 API 服务器、ectd、Scheduler、kube-controller-manager 和 cloud-controller-manager。 Worker processes include kubelet, kube-proxy, and your container runtime.工作进程包括 kubelet、kube-proxy 和您的容器运行时。

Container—the image you create to hold your applications.容器——您创建的用于保存应用程序的映像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM