How to Install Kubernetes on Windows and macOS?

By | June 13, 2022
Install Kubernetes on Windows and macOS

Kubernetes was designed to help developers easily manage their cloud resources as well as build scalable apps. It is known to be the most popular and helpful tool when it comes to automate, deploy, and scale your cloud applications.

Kubernetes supports almost all popular operating systems, including Windows, macOS, and Linux. In this article, we are going to talk about the easiest ways to install Kubernetes so that you can automate deployments and perform other important things for your web applications.

What is Kubernetes All About?

Kubernetes is portable, open-sourced, and extensible, which helps you manage and operate your containerized applications and services. It is a fast-growing ecosystem that helps you manage containerized applications with peace of mind. When you install Kubernetes, you can choose the application type you are looking to build.

All of these features require different ways to set up and run Kubernetes on your system. However, you can also deploy a cluster of Kubernetes on your local system as well as on the cloud.

Kubernetes is one of the best and easiest ways to power cloud-native microservices. It comes with a galore of benefits that attract developers from all over the world. Its benefits include the following:

  • Comes with a cloud-native design that helps a modular, distributed architecture to effectively monitor and scale the applications.
  • Kubernetes is easy to carry and move. If you are moving it to your Windows system from Linux, it will work exactly the same way it worked on Linux. Regardless of the type of environment, it is in, Kubernetes will use the same images and configuration.
  • Being open-source, developers find Kubernetes extremely helpful as it can be used anywhere. There is no concern regarding its setups, and that’s why Kubernetes has become the world’s most validated application manager.

The first step is to know what Kubernetes is all about (which you just did) and the next step is to find out how to install it on your computer regardless of what OS you are using. We will talk about how to install Kubernetes soon, but before that, let’s find out how Kubernetes play a role in placing, scaling, replicating, and monitoring containers on nodes.

How Does Kubernetes Work?

Kubernetes is the easiest way to manage the lifecycle of a containerized application in various environments. It can easily automate and scale several containers at once. Containers refer to the series of application data and resources that are important for the apps to run and operate in different environments.

If Kubernetes wasn’t there, developers wouldn’t be able to carry and transfer application data without losing their value and resources. Kubernetes acts as a container orchestration system that groups the application data so that they can operate correctly.

Kubernetes works as the administrator for operating containerized applications. If a container needs anything to operate properly, such as resources, the container orchestrator takes care of it. Kubernetes have different components that take care of all its business in just a short time span.

Prerequisites of Installing Kubernetes

Have a look at the requirements for installing Kubernetes on different PCs:

Hardware requirements (You need one of more machines that are running these components)

  • Ubuntu 16.04+
  • Debian 9
  • CentOS 7
  • RHEL 7
  • Fedora 25/26 (best-effort)
  • HypriotOS v1.0.1+
  • Container Linux (tested with 1800.6.0)

But don’t worry, you can install Kubernetes on Windows and macOS without an effort. We will be going to show you how, later in this post.

Requirements for memory & CPU (cores) at the minimum

  • 2GB of memory for the master node and 1GB of memory for the worker node at the minimum.
  • The master node needs 1.5 core, and the worker node needs 0.7 cores at the minimum.

You need to consider the following criteria before installing Kubernetes on your system:

  • Make sure your Kubernetes solution install clusters have underlying metadata and high available replication to back you up if any failure occurs.
  • The developers of Kubernetes release a major update every 3-4 months. Ensure a good upgrade strategy of Kubernetes to make your business operations as smooth as possible.
  • Ensure if your Kubernetes supports federated clusters installation that can grow in private and public cloud systems for the strength of infrastructure and dynamic burst ability.
  • What professional features do you and your team members need to scale the applications? You may need SSO support, RBAC, isolated networking, persistent storage. Confirm your requirements.

Once you ensure that your system meets all these requirements, you can manage and install kubeadm, kubelet, and kubectl (clusters) as many as you can, and at the same time, you can deploy the pods or docker containers in the cloud platform.

Below, we have demonstrated the steps to install Kubernetes and using the official web GUI dashboard to manage the applications.

How to Install Kubernetes on Windows 10?

Step 1: Install & Setup Hyper-V

VirtualBox and HyperV are virtualization software. Both are available for Windows 10. However, the two are very similar such that people easily confuse them with each other. VirtualBox is for steroids which you can always use on your Windows 10 system.

Your Microsoft account has a default GUI tool that the Hyper-V can use to manage the virtual machines (VM) for free. You can easily enable Hyper-V but for that ensure that your computer is totally compatible with the process. You should meet the following requirements:

  • Windows 10 (Enterprise, Pro, or Education).
  • 4GB RAM and CPU Virtualization support that has to be enabled in the BIOS settings.

Hyper-V is not always present in your Windows 10 system, but you can easily enable the feature by following the steps below:

  • Step 1: Open Control Panel (Type Control Panel in the Windows search option).
  • Step 2: Click on Programs on the left-side menu.
  • Step 3: Then click on Programs and Features.
  • Step 4: Next, click on Turn Windows features on and off from the left-side.
  • Step 5: Check the Hyper-V and Windows Hypervisor Platform option.
  • Step 6: Then click OK.

Your computer will start installing Hyper-V in the background, and once it’s done or in the process, you may have to reboot your computer a few times. However, once it is installed, they won’t send you any notification.

You will have to check manually whether the feature is installed or not. You can run the Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V command on your Windows Powershell as an Administrator to check out the status of the process.

Step 2: Install Docker on Windows

Kubernetes manages all the components of your docker containers. The container orchestrator interacts with your docker containers to set everything in place smoothly. Therefore, having Docker on your system is important and if you have not installed it already, you can do so with the steps below:

  • Step 1: Go to hub.docker.com.
  • Step 2: Scroll down and find the Get Docker Desktop for Windows button and click on it.
  • Step 3: Then follow the on-screen instructions for installing Docker.
  • Step 4: Click on Finish.

You won’t have to do anything after that. Docker has an automatic setup of a Linux virtual machine above Hyper-V, and it will start all the necessary services without any human intervention. After the process is completed, you can communicate with Docker using the CLI tool, or you can also run HTTP requests through its API.

Step 3: Install Kubernetes on Windows 10

You can install as well as enable Kubernetes from the GUI tool within Docker itself. First, find the tray icon of the docker in your system tray. If you can’t locate any, you will have to reboot your system again.

Or if you can’t still find the tray, you can go to this link to troubleshoot the error. And once resolved, follow the instructions below to install Kubernetes with ease:

  • Step 1: Find the docker tray icon and right-click on it.
  • Step 2: Go to “Settings.”
  • Step 3: Click on “Kubernetes” from the left panel.
  • Step 4: Tick the Enable Kubernetes option.
  • Step 5: Click on Apply.

While enabling Kubernetes, Docker will install some packages and dependencies on your system, which is going to take around 5~10 minutes depending on the speed of your computer and internet connection.

When the installation is over, Docker will let you know through a pop-up notification. After the installation, use the Docker application to ensure it is working or not, if it is, both of the features will have a green light at the bottom of the docker dashboard. And your next step will be to install the Kubernetes dashboard to proceed further with the process.

Step 4: Install the Kubernetes Dashboard

From the Kubernetes dashboard, you can manage the resources as it is a web-based UI. That’s why installing the Kubernetes dashboard is necessary. You can deploy applications with Kubernetes using the CLI tool, kubectl that will help you interact with the clouds to manage your pods as well as nodes, and clusters.

Let’s run some commands on your system to deploy and enable the dashboard. All you need to do is just run some commands and click on the right buttons whenever necessary. This is how to do it:

  • Step 1: Go to this link and download the yaml configuration file.
  • Step 2: Run the kubectl apply -f .\recommended.yaml command to deploy the yaml configuration file.
  • Step 3: To check if the kubectl is running or not, verify it using the kubectl.exe get -f .\recommended.yaml.txt command.

Once it is running, you can easily access the dashboard. Follow the next step if you are unsure of the process.

Step 5: Accessing the Kubernetes Dashboard

During the installation of Kubernetes, your system created a default token, and you can use that token to get into the Kubernetes dashboard. Or you can create new users and give them permission to get the default token. But, getting the token alone and using it will be the simplest way to access the dashboard. So, let’s get to it:

  • Step 1: Run the ((kubectl -n kube-system describe secret default | Select-String “token:”) -split ” +”)[1] command on Windows Powershell and not Command prompt.
  • Step 2: It will generate the token we are looking for.
  • Step 3: Once it does, you will have to copy that token.
  • Step 4: Then run the kubectl proxy command in the same Powershell window.
  • Step 5: Go to your browser and paste and visit this link.
  • Step 6: Select Token from the link.
  • Step 7: Go back to your Powershell window and paste the token.
  • Step 8: It will take some time to go with the process, but once done, you will have the sign-in option.

When everything is done, you will be able to see the dashboard and your cloud resources and you can do whatever you need to arrange your containerized applications. This process is applicable for Windows users only. However, if you are running macOS or another operating system, read on to find out more about the installation process.

How to Install Kubernetes on macOS?

You can develop applications on your Mac by following this step-by-step guide. Check out the How to install Kubernetes on Windows section above to grab a better understanding of this process.

However, to run Kubernetes, you will have to have some necessary tools such as Homebrew, Docker for Mac, Minikube, VirtualBox, and kubectl—the same things that we have used in Windows earlier.

You can install Homebrew on your macOS by running the brew tap caskroom/cask command in your Terminal. And within Homebrew, you can install Virtualbox for Mac by running the brew cask install VirtualBox command. We need the following items to run Kubernetes on macOS:

  • Run the containers.
  • The command-line tool, kubectl.
  • The oc command-line tool for Red Hat OpenShift.
  • An image to run the Kubernetes test.

Now, follow the steps below to proceed with installing Kubernetes on macOS. If you have run the brew install kubectl command on your Terminal to install kubectl, you are now good to go with these next steps:

  • Step 1: Install Minikube from Installation > OSX instructions from the latest release and run the curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.27.0/minikube-darwin-amd64 &&\ command in your Terminal. This will help Minikube to run in the Kubernetes cluster with a single node.
  • Step 2: Start the cluster with a minikube start command and then run kubectl api-versions in the Terminal. You will see a list of versions on-screen that confirms that everything is working fine. But the minikube start command line will take some time to complete.

Sometimes the “Error starting host: Error getting state for the host: machine does not exist.” error comes up. But whenever it does, you can easily erase it. Here is how to do it:

  • Step 1: Run open ~/.minikube/. It will open Minikube’s data files.
  • Step 2: To prevent the particular error from happening again, you can delete the machines directory.
  • Step 3: Then run the minikube start command again.

This should do it and run Kubernetes on your macOS. However, you will need to know how these different components relate to each other so that you can go with Kubernetes more conveniently. Here’s the same:

  • VirtualBox lets you run a different virtual machine on your macOS. Kubernetes is specially designed for the Ubuntu users. But even if you use a Mac you can use VirtualBox to install Ubuntu or Windows on your computer.
  • To run the Kubernetes clusters on your machine, you will need Minikube, which is a Kubernetes-specific package. Kubernetes clusters come with some unique sets of features that help the applications to run in the local environment.
    Once VirtualBox is installed on your computer, it will need Minikube to tell it what to do, when to run and when to stop. Not just the VirtualBox though, Minikube is capable of running other virtualization tools as well. However, those tools may need some extra configuration settings.
  • Once you have Minikube, you will need kubectl because without it you cannot interact with the Minikube Kubernetes cluster. To manage your Kubernetes environments, kubectl will send an HTTP request to the Kubernetes API server that runs on the cluster.

Conclusion

That’s all. The whole process needs time and patience, and once it is done, you can start managing your applications effortlessly. If you go through the How to install Kubernetes on Windows section of this post, you will be able to pull off the process in macOS as well. If you need any help, let us know in the comments box below.

Leave a Reply

Your email address will not be published.