In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to create a single-node Kubernetes cluster on Windows 10". In the daily operation, I believe that many people have doubts about how to create a single-node Kubernetes cluster on Windows 10. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to create a single-node Kubernetes cluster on Windows 10"! Next, please follow the editor to study!
Kubernetes enables developers and system administrators to quickly deploy applications and extend them to their needs without downtime. The Kubernetes system is highly configurable, and almost everything revolves around four important concepts: nodes, pod, deployment, and services.
Are you ready to enter the world of Kubernetes? This is the key step and Kubernetes command to start with.
Learn the basics of Kubernetes architecture
First of all, it is useful to understand the basics of the Kubernetes system. The server that runs the container and its internal applications are called nodes. The master server controls, manages and configures these node servers. The primary node also manages the Pod or a set of one or more containers that reside on the node.
The master server acts as the control plane of the Kubernetes cluster. The main purpose of the various components in the control plane is to maintain the records of all Kubernetes objects and to continuously manage the desired state of the cluster by automatically responding to changes.
The control plane has four main components:
The most basic component of the Etcd:Kubernetes cluster etcd is lightweight available configuration storage. It can be set across multiple Kubernetes nodes. Its main purpose is to store configuration data that is accessible to every node in the Kubernetes cluster.
Kube-apiserver: this is the RESTful interface for command-line tools such as kubectl, providing them with a way to interact with the Kubernetes cluster. Simply put, it acts as a management point for various tools to control and configure Kubernetes clusters through REST API.
Kube controller management: the primary role of this service is to maintain the state of the cluster, such as the number of replicas. If any change in the desired state is observed, kube-controller-manager will run the required process to ensure that the desired state is met.
Kube Scheduler: the primary responsibility of this component is to plan cluster workloads based on configuration, resource requirements, and workload-specific requirements.
The node server has multiple components that make them available to the primary server. These include:
Container runtime: to run applications encapsulated in the pod that exist on the node, we need a lightweight, isolated operating environment: the container. The container runtime is a tool, such as Docker, for creating, deploying, and running applications.
An Kubelet:Kubelet is an agent or service installed on a node to communicate with and receive commands from the primary node. It guides the actions that need to be performed on the node, such as creating, scaling, and deleting containers.
Kube proxy: this proxy service relays requests to the correct container and performs load balancing. Kube-proxy also performs host-level subnetting to ensure that other components can access services.
Kubernetes implementation steps
In this tutorial, we will create a single-node cluster running on the Windows 10 operating system.
To install and set up Kubernetes on Windows, load kubectl and install minikube. The Chocolatey package manager provides assistance in this process. The command line tool kubectl runs commands on the Kubernetes cluster, and minikube is the tool that enables us to run a single-node cluster in VM on the machine. Enter the command:
Choco install Kubernetes-cli minikube
This returns the output shown below:
Now, run the following command and verify that kubectl is installed on your computer:
Kubectl.exe version-client
You must see similar output in the following screenshot:
Next, start a worker-or node in Kubernetes. It can be a physical machine or a virtual machine. To do this, start minikube with the following command:
Minikube start
This returns the output shown below:
Since we installed Kubernetes on Windows, use Hyper-V to start VM and set up the Kubernetes cluster on VM.
This completes the setup.
How to run a container in Kubernetes
To start the container, use the following Kubernetes command to create the deployment. Provide the deployment name and the container image to deploy. Kubernetes will automatically select Docker as the default container runtime. Here, we use the image that will run the Nginx Web server:
Kubectl.exe create deployment my-nginx-image nginx
After the deployment is created, Kubernetes builds the Pod to host the application instance.
Enter get pods immediately after running the previous command to capture the ContainerCreating status when deploying pod:
Kubectl.exe get pods
This will be done in a few seconds, and the container state should be changed to running:
Use the describe keyword with the deployment name as shown below to view more details about the deployment:
Kubectl.exe get deployment kubectl.exe describe deployment helloworld-nginx
This returns the results, such as the number of copies, required status, and timestamp:
In this Kubernetes implementation tutorial, we only run a container or Nginx server, but sometimes we have to adapt to the increased workload and traffic. In this case, expand the number of application instances. This can be achieved by using a kubectl scale deployment with the-- replicas parameter:
Kubectl.exe scale deployment helloworld-nginx-replicas 4
Check the deployment. You will observe that four copies of the application instance have been deployed:
Now, check that the Kubernetes pod; should run four containers on this node:
Start the application and run
There is now an application running in multiple containers with their respective IP addresses. Next, expose them outside the cluster so that you can access the application:
Kubectl.exe expose deployment helloworld-nginx-port=80-type=NodePort
Verify through the kubectl get services command. This returns the service type of NodePort to expose port 80 on each node of the Kubernetes cluster. The service is an abstraction layer that basically achieves load balancing and groups more than one pod in clusters that share IP addresses.
To open this application in a Web browser, create a proxy to connect the local port to the cluster port, which we exposed using the NodePort service in the previous step:
Kubectl.exe port-forward svc/helloworld-nginx 80:80
As follows:
Go to the Web browser and open http://127.0.0.1/ or http://localhost/ to view the home page of the Nginx Web server deployed in the Kubernetes container.
Test the Kubernetes control plane
Finally, test whether the Kubernetes control plane or the master server can maintain the required state of the Pod running on the node server. To check this, use the following command to force the deletion of a container running the application instance:
Kubectl.exe delete pod helloworld-nginx-67bb76cf46-mks6j
Recognizing this unwanted state, Kubernetes will immediately run a new instance of the application in the container:
At this point, the study on "how to create a single-node Kubernetes cluster on Windows 10" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.