10 X Sale-mobile

HomeBlogDevOpsHow to Install Kubernetes on Windows? Step-by-Step Guide

How to Install Kubernetes on Windows? Step-by-Step Guide

Published
30th May, 2024
Views
view count loader
Read it in
10 Mins
In this article
    How to Install Kubernetes on Windows? Step-by-Step Guide

    With the increasing complexity of contemporary software creation, containerization techniques have become essential since they are practical and flexible in transporting applications.

    As more and more organizations adopt hybrid and multi-cloud, Kubernetes becomes a strategic instrument to harmonize and organize container-based workloads. In 2022, Platform9 published a survey among enterprises where it was stated that as many as 85% run containerized apps in production, with Kubernetes being the most common choice out of several other options for orchestration.

    Let’s get started. We will guide you through the complete roadmap on how to install Kubernetes for Windows users. This tutorial will show you how to set up Kubernetes and deploy the official web GUI dashboard, which will allow you to manage and monitor everything.

    Kubernetes Installation System Requirements for Windows 

    For installing Kubernetes in your system, here are a few prerequisites that need special attention. The hardware and software requirements are discussed below:

    A. Hardware requirements

    • Master node with at least 2 GB memory. (Additional will be great)
    • Worker node with 700 MB memory capacity.
    • Your Mouse/Keyboard (monitor navigation)

    B. Software requirements

    • Hype-V
    • Docker Desktop
    • Unique MAC address
    • Unique product UUID for every node

    C. Additional Libraries or Tools (Installed Prior)

    • Enable Hyper-V and the WSL.
    • Enable Kubernetes and Microsoft’s PowerShell functionality.
    • Ensure you install all the required libraries and other tools beforehand for proper Kubernetes usage.
    • Ensuring that there is a full range of connectivity between all the machines in the cluster is a must.

    How to Install Kubernetes on Windows? In 5 Simple Steps

    Let's discuss the detailed process on how to install Kubernetes on Windows in just five simple steps:

    Step 1: Install & Setup Hyper-V

    As we all know, Windows has its virtualization software, known as Hyper-V, which is essentially VirtualBox on steroids. Hyper-V allows you to manage your virtual machines (VMs) using either the free Microsoft GUI tool or the command line. It's simple to enable Hyper-V, but first, make sure your PC meets the following requirements:

    • Your operating system should be Windows 10 (Enterprise, Pro, or Education), with
    • At least 4GB of RAM and CPU Virtualization support, though you should double-check that it's turned on in your BIOS settings.

    You can disable or enable features like Hyper-V that may not be pre-installed when Windows is installed. Always keep in mind that some of the features require internet access to download additional Windows Update components.

    To enable Hyper-V on your machine, follow the steps below:

    1. Open the Control Panel.
    2. Select Programs from the left panel.

    How to Install Kubernetes on Windows

    3. Next, go to Programs and Features, then Turn Windows Features On or Off.
    4. Examine Hyper-V and the Hypervisor Platform for Windows.

    5. Select OK.

    Your system will now begin installing Hyper-V in the background; it may be necessary to reboot a few times until everything is properly configured. Don't hold your breath for a notification or anything! Verify that Hyper-V is installed successfully on your machine by running the following command as Administrator in PowerShell:

    Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V

    Once the state is shown as Enabled for above command in Power shell, we are good to go.

    Step 2: Download Docker for Windows and install it.

    Kubernetes is a container orchestration system built on top of Docker. It is essentially just a tool for communicating with Docker containers and managing everything at an enterprise level. Simply go to install Docker and click to Get Docker Desktop for Windows (stable).

    Windows users can use Docker Desktop

    Docker Desktop for Windows is a version of Docker optimized for Windows 10. It's a native Windows application that makes developing, shipping, and running dockerized apps simple. Docker Desktop for Windows is the fastest and most reliable way to develop Docker apps on Windows, as it uses Windows-native Hyper-V virtualization and networking. Docker Desktop for Windows can run Docker containers on both Linux and Windows.

    Installation of Docker Desktop

    Let us take a look on the different steps involved in installing docker desktop.

    1. Double-click Docker for Windows Installer to run the installer.
    2. Docker starts automatically once the installation is complete. Docker is running and accessible from a terminal, as indicated by the whale in the notification area.
    3. Run .
    4. Try out some Docker commands in a command-line terminal like PowerShell!  
    5. Run the Docker version to check the version.
    6. Run Docker run hello-world to verify that Docker can pull and run images.
    7. Boom!

    As long as the Docker Desktop for Windows app is running, Docker is accessible from any terminal. The Docker whale in the taskbar has a setting button that can be accessed from the UI.

    For a detailed step by step installation guide with screenshot, visit the blog - How to Install Docker on Windows, Mac, & Linux: A Step-By-Step Guide

    WARNING: FOLLOW THE INSTRUCTIONS BELOW! If Docker was successfully installed but you can't find its tray icon, you'll need to restart your computer. Check the official troubleshooting guide here if the issue persists.

    Step 3: Install Kubernetes on Windows 10

    Docker includes a graphical user interface (GUI) tool that allows you to change some settings or install and enable Kubernetes.

    To install Kubernetes, simply follow the on-screen instructions on the screen:

    1. Right-click the Docker tray icon and select Properties.
    2. Select "Settings" from the drop-down menu.

    3. Select "Kubernetes" from the left panel.
    4. Check Enable Kubernetes and click "Apply"

    Docker will install additional packages and dependencies during the installation process. It may take between 5 and 10 minutes to install, depending on your Internet speed and PC performance. Wait until the message 'Installation complete!' appears on the screen. The Docker app can be used after Kubernetes has been installed to ensure that everything is working properly. Both icons at the bottom left will turn green if both services (Docker and Kubernetes) are running successfully and without errors.

    Example.
    Step 4: Install Kubernetes Dashboard

    The official web-based UI for managing Kubernetes resources is Kubernetes Dashboard. It isn't set up by default. Kubernetes applications can be easily deployed using the cli tool kubectl, which allows you to interact with your cloud and manage your Pods, Nodes, and Clusters. You can easily create or update Kubernetes resources by passing the apply argument followed by your YAML configuration file.

    Use the following commands to deploy and enable the Kubernetes Dashboard.

    1. Get the yaml configuration file from here.
    2. Use this to deploy it.

    . kubectl apply -f .\recommended.yaml

    3. Run the following command to see if it's up and running.:

    kubectl.exe get -f .\recommended.yaml.txt

    Step 5: Access the dashboard

    The dashboard can be accessed with tokens in two ways: the first is by using the default token created during Kubernetes installation, and the second (more secure) method is by creating users, giving them permissions, and then receiving the generated token. We'll go with the first option for the sake of simplicity.

    1. Run the following command PowerShell (not cmd)

    ((kubectl -n kube-system describe secret default | Select-String "token:") -split " +")[1]

    2. Copy the generated token
    3. Run

    kubectl proxy.

    4. Open the following link on your browser: 

    http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/

    5. Select
    Token & paste the generated token
    6. Sign In

    Finally

    You'll be able to see the dashboard and your cloud resources if everything is set up correctly. You can then do almost all of the "hard" work without having to deal with the CLI every time. You may occasionally get your hands dirty with the command line, but if you don't understand Docker and Kubernetes or don't have the time to manage your own cloud, it's better to stick with some PaaS providers that can be quite expensive.

    How to Use Kubernetes?  

    Kubernetes is one of the effective container orchestration platforms that automatically deploys, scales, and manages containerized applications. After we have seen how to install Kubernetes on Windows, here are the top three tips that I prefer when using Kubernetes: 

    Understand the Basics: 

    • Pods: Smallest deployable units in Kubernetes. Each container might be a pod with the same or different network space, volume, and port mapping. 

    • Deployments: Establish the targeted state that you would want for your application. These help you to have a certain number of copies of your application available and operational throughout. 

    • Services: Connect a group of pods to a network. They help in load balancing, service discovery, and providing stable network endpoints. 

    Use Declarative Configuration: 

    Kubernetes is built as a declarative system that describes the needed condition and leaves it to care for itself. Define your applications, services, and other resources in YAML or JSON configuration files. State your need and go to Kubernetes to show how to arrive at and sustain this stage. 

    Learn and use kubectl: 

    Kubectl is the command-line interface between a Kubernetes cluster and user(s). Check your cluster status using kubectl get, kubectl describe, and kubectl logs for a view of pods and services. You can also enroll in a certified DevOps Foundation course to learn in a better way.  

    How to Uninstall Kubernetes on Windows?

    The procedures for uninstalling cert-manager on Kubernetes are outlined below. Depending on which method you used to install cert-manager - static manifests or helm - you have two options.

    Warning: To uninstall cert-maneger, follow the same steps as you did to install it, but in reverse. Whether cert-manager was installed from static manifests or helm, deviating from the following process can result in issues and potentially broken states. To avoid this, make sure you follow the steps outlined below when uninstalling.

    Step 1: Before continuing, make sure that all user-created cert-manager resources have been deleted. You can check for any existing resources with the following command:

    $ kubectl get Issuers,ClusterIssuers,Certificates,CertificateRequests,Orders,Challenges --all-namespaces

    After you've deleted all of these resources, you can uninstall cert-manager by following the steps outlined in the installation guide.

    Step 2: Using regular manifests to uninstall.

    1. Uninstalling from a regular manifest installation is as simple as reversing the installation process and using the delete command.
    kubectl.

    2. Delete the installation manifests using a link to your currently running version vX.Y. Z like so:

    $ kubectl delete -f https://github.com/jetstack/cert-manager/releases/download/vX.Y.Z/cert-manager.yaml

    Step 3: Uninstalling with Helm.

    1. Uninstalling cert-manager from a Helm installation is as simple as reversing the installation process and using the delete command on both the server and the client. kubectl and helm.

    $ helm --namespace cert-manager delete cert-manager

    2. Next, delete the cert-manager namespace:

    $ kubectl delete namespace cert-manager

    3. Finally, delete the cert-manger  CustomResourceDefinitions using the link to the version vX.Y.Z you installed:

    $ kubectl delete -f https://github.com/jetstack/cert-manager/releases/download/vX.Y.Z/cert-manager.crds.yaml

    The namespace is in the process of being terminated.

    The namespace may become stuck in a terminating state if it is marked for deletion without first deleting the cert-manager installation. This is usually because the APIService resource is still present, but the webhook is no longer active and thus no longer reachable.

    4. To fix this, make sure you ran the above commands correctly, and if you're still having problems, run:

    $ kubectl delete apiservice v1beta1.

    What is Kubernetes?

    Kubernetes is a container-based platform for managing cloud resources and developing scalable apps. It is widely regarded as the most common platform for automating, deploying, and scaling the entire cloud infrastructure. The platform runs on all major operating systems and is the most widely used open-source cloud tool.

    Kubernetes can scale your entire infrastructure, monitor each service's health, act as a load balancer, and automate deployments, among other things. You can deploy your pods (docker containers) and services across the cloud by installing and configuring as many nodes (clusters) as you want.

    Kubernetes

    Conclusion

    In this tutorial, we have explained in detail how to install Kubernetes with Hyper-V. Also, we have tackled what requirements we need, both in terms of the software and hardware. We have explained how to install Hyper-V and Docker on Windows 10.  It is important to note that the fundamental difference between Kubernetes and Docker is that Kubernetes is meant to run across a cluster and Docker is meant to run through nodes.   

    Kubernetes is also more extensive than Docker Swarm and is meant to coordinate a cluster of nodes at scale in production in an efficient manner. Each software is crucial to having a smooth installation process.   

    You must ensure you are well-versed with DevOps concepts for the best outcome. Want to learn Kubernetes and how to use it? KnowledgeHut-certified DevOps foundation courses are perfect as per my experience to get the best hands-on learning of Kubernetes to build scalable applications.

    Frequently Asked Questions (FAQs)

    1What is the easiest way to install Kubernetes on Windows?

    Setting up a Kubernetes cluster on your local machine is very easy if you use Docker Desktop, making the installation process simple. 

    2Do all Kubernetes features work on Windows?

    Not all Kubernetes features supported by Windows are available as they differ in some regards. One must also confirm with the Kubernetes docs which specific features work in Windows. 

    3Is there a specific version of Windows Server required for Kubernetes on Windows?

    Yes, Kubernetes on Windows demands Windows Server 2019 and above versions for containerization and orchestration. 

    4Are there any limitations when using Windows containers in Kubernetes?

    Yes, there are challenges to some extent. For instance, some network plugins are unsupported, while Linux containers may act differently. Please refer to the Kubernetes documentation for more specific information about Windows container limitations. 

    Profile

    KnowledgeHut .

    Author

    KnowledgeHut is an outcome-focused global ed-tech company. We help organizations and professionals unlock excellence through skills development. We offer training solutions under the people and process, data science, full-stack development, cybersecurity, future technologies and digital transformation verticals.

    Share This Article
    Ready to Master the Skills that Drive Your Career?

    Avail your free 1:1 mentorship session.

    Select
    Your Message (Optional)

    Upcoming DevOps Batches & Dates

    NameDateFeeKnow more
    Course advisor icon
    Course Advisor
    Whatsapp/Chat icon