{"id":71826,"date":"2019-05-03T09:01:50","date_gmt":"2019-05-03T09:01:50","guid":{"rendered":"https:\/\/www.whizlabs.com\/blog\/?p=71826"},"modified":"2022-05-30T05:57:52","modified_gmt":"2022-05-30T11:27:52","slug":"introduction-to-kubernetes","status":"publish","type":"post","link":"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/","title":{"rendered":"An Introduction to Kubernetes: Learn the Basics"},"content":{"rendered":"<p>This blog post is all about Kubernetes which is an open-source platform that helps to manage container workloads in Cloud. Here, In this Kubernetes Tutorial, we help you to learn Kubernetes from the scratch.<\/p>\n<p><span class=\"s1\">Kubernetes has emerged as one of the most exciting technologies in the world of DevOps that has gained a lot of attention of the DevOps professionals. Kubernetes, or commonly known as k8s, is an open-source, portable and extensible platform, for managing containerized workload and services. This container orchestration system is put to automating the deployment, scaling, as well as management of the application. <\/span><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">As one of the top DevOps tools, the primary aim of Kubernetes is to provide a platform that allows streamlining of deployment, scaling, and operations of application containers across a cluster of hosts. <\/span><span class=\"s1\">Plenty of cloud services provide Kubernetes based platform as a service (PaaS) as well as infrastructure as a service (IaaS).<\/span><\/p>\n<p><a href=\"https:\/\/www.whizlabs.com\/learn-kubernetes-with-aws-and-docker\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-71809 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/04\/Kubernetes_with_AWS_and_Docker.gif\" alt=\"Kubernetes with AWS and Docker\" width=\"728\" height=\"90\" \/><\/a><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">Currently, Kurbenetes works with a plethora of tools like Docker. Kubernetes has helped in optimizing the app development for cloud, and naturally, many professionals are driven to learn Kubernetes and excel in it. In this article, we&#8217;ll help you understand the basics of Kubernetes through an introduction to Kubernetes\u00a0<\/span><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #ea7e02;color:#ea7e02\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #ea7e02;color:#ea7e02\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#Introduction_to_Kubernetes\" >Introduction to Kubernetes<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#What_are_the_Kubernetes_objects\" >What are the Kubernetes objects?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#How_does_Kubernetes_work\" >How does Kubernetes work?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#What_are_the_Uses_of_Kubernetes\" >What are the Uses of Kubernetes?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#What_are_the_Advantages_of_Kubernetes\" >What are the Advantages of Kubernetes?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#How_to_Learn_Kubernetes\" >How to Learn Kubernetes?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#What_is_Minikube\" >What is Minikube<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#How_to_install_Kubernetes_on_Ubuntu_with_kubeadm\" >How to install Kubernetes on Ubuntu with kubeadm<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#Prerequisites_before_installing_Kubernetes_on_Ubuntu\" >Prerequisites before installing Kubernetes on Ubuntu<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#Installing_Kubernetes_on_Ubuntu_2004\" >Installing Kubernetes on Ubuntu 20.04<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/www.whizlabs.com\/blog\/introduction-to-kubernetes\/#Summary\" >Summary<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"p3\" style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Introduction_to_Kubernetes\"><\/span><span class=\"s1\">Introduction to Kubernetes<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">The introduction to Kubernetes first happened in the year 2014, by none other than the technology giant Google. A few Google engineers worked upon it, alongside Brendan Burns, Joe Breda, and Craig McLuckie. The design and development of Kubernetes relied heavily upon the Borg System of Google. Incidentally, a majority of the contributors had already worked upon Borg. <\/span><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">The project was initially given the name of Project Seven of Nine, based on a Star Trek reference. The logo contains seven spokes, which stand for that codename. They used C++ language to write the original Borg project. However, the rewritten system is implemented in Go. Kubernetes v1.0 was introduced in 2015 for use. Google, along with the release, decided to partner with Linux Foundation. <\/span><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">Together they formed the Cloud Native Computing Foundation, and Kubernetes was on offer as a seed technology. By March 2018, Kubernetes reached the 9<\/span><span class=\"s2\"><sup>th<\/sup><\/span><span class=\"s1\"> place in commits at GitHub and 2<\/span><span class=\"s2\"><sup>nd<\/sup><\/span><span class=\"s1\"> in authors and issues to Linux Kernel. <\/span><\/p>\n<h3 class=\"p3\" style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"What_are_the_Kubernetes_objects\"><\/span><span class=\"s1\">What are the Kubernetes objects?<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">It is essential to learn Kubernetes objects to understand how Kubernetes works. The Kubernetes operates as a set of building blocks that that collectively provide a mechanism for applications. It is extensible and loosely coupled to meet up the different workload expectations. The Kubernetes Objects are the resources that help to exert control over the computer and storage resources.\u00a0<\/span><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><strong><span class=\"s1\">The key objects are:<\/span><\/strong><\/p>\n<ul class=\"ul1\" style=\"text-align: justify;\">\n<li class=\"li3\"><span class=\"s1\">Pods: Pod is the basic scheduling unit of a Kubernetes. A single pod can consist of a single or even more container that are co-located on the same host machine and can easily share resources. It can add a higher level of abstraction by grouping containerized components. Each pod also has a unique Pod IP address. <span class=\"Apple-converted-space\">\u00a0 \u00a0<\/span><\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Services: A set of pods, that can work together, as one tier or even multi-tier is known as<span class=\"Apple-converted-space\">\u00a0 <\/span>Kubernetes services. Kubernetes can provide two modes of service discovery, using Kubernetes DNS or using environmental variables.<span class=\"Apple-converted-space\">\u00a0 <\/span><\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Volumes: In the Kubernetes container the filesystems provide ephemeral storage. It implies that upon restarting the container will wipe out the data, making the storage very limiting. However, the Kubernetes volumes provide lifelong storage in the pod itself. <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Namespaces: To ensure that the non-overlapping of resources, Kubernetes provides a partition known as namespaces. They can be used in the case of many users, teams, or projects.<span class=\"Apple-converted-space\">\u00a0 \u00a0<\/span><\/span><\/li>\n<\/ul>\n<h3 class=\"p3\" style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"How_does_Kubernetes_work\"><\/span><span class=\"s1\">How does Kubernetes work?<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">The Kubernetes has a primary\/replica architecture. Kubernetes architecture consists of a lot of components. These components can be divided into the ones that manage an individual node, and the others are a part of the control plane. It is essential to understand the architecture if you wish to learn Kubernetes. <\/span><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><strong><span class=\"s1\">Key areas of Kubernetes architecture are:<\/span><\/strong><\/p>\n<ul class=\"ul1\" style=\"text-align: justify;\">\n<li class=\"li3\">\n<h4><span class=\"s1\">Kubernetes Node: <\/span><\/h4>\n<\/li>\n<\/ul>\n<p class=\"p5\" style=\"text-align: justify;\"><span class=\"s1\">A node is a machine which deploys the workloads or containers. It is also commonly referred to as a Minion or Worker. Each node is the cluster needs to run a container runtime like Docker. Apart from that, it requires a series of other components for easy communication with the primary, for network configuration of these components.<span class=\"Apple-converted-space\">\u00a0 <\/span>The other components are:<\/span><\/p>\n<ol class=\"ol1\" style=\"text-align: justify;\">\n<li class=\"li3\"><span class=\"s1\"><strong>Kubelet:<\/strong> A kubelet is a component that ensures that each node is in a running state and that all the containers are healthy. The process of stating, stopping, and maintaining application containers is taken care by kubelet. It monitors the state of the pod, and if they are not in the desired state, the pod re-deploys the same node. <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\"><strong>Kube-proxy:<\/strong> The Kube-proxy handles the implementation of a load balancer and a network proxy.<span class=\"Apple-converted-space\">\u00a0 <\/span>The primary aim of this component is to route traffic to the right container on the basis of IP and port number. <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\"><strong>Container runtime:<\/strong> A container resides inside the pod. A container is the lowest level of micro-services. It ideally holds running applications, libraries, and their dependencies. <span class=\"Apple-converted-space\">\u00a0 \u00a0<\/span><\/span><\/li>\n<\/ol>\n<figure id=\"attachment_71875\" aria-describedby=\"caption-attachment-71875\" style=\"width: 760px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-71875 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Kubernetes_Architecture.png\" alt=\"Kubernetes Architecture\" width=\"760\" height=\"520\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Kubernetes_Architecture.png 760w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Kubernetes_Architecture-300x205.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Kubernetes_Architecture-614x420.png 614w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Kubernetes_Architecture-640x438.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Kubernetes_Architecture-681x466.png 681w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/><figcaption id=\"caption-attachment-71875\" class=\"wp-caption-text\">Kubernetes Architecture<\/figcaption><\/figure>\n<ul class=\"ul1\" style=\"text-align: justify;\">\n<li class=\"li3\">\n<h4><span class=\"s1\">Kubernetes Control Plane:<\/span><\/h4>\n<\/li>\n<\/ul>\n<p class=\"p5\" style=\"text-align: justify;\"><span class=\"s1\">The primary or the control plane is the major component of the Kubernetes architecture. It is responsible for managing the workload and directing the communication across the systems. The control plane consists of various parts, each having its own process. They can run either on a single primary node and also on multiple primaries supporting high-availability clusters. The various components are:<\/span><\/p>\n<ol class=\"ol1\" style=\"text-align: justify;\">\n<li class=\"li3\"><span class=\"s1\"><strong>etcd:<\/strong> etcd is a data store which a CoreOS can develop. It is lightweight, persistent, distributes, and stores key-value configuration data. <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\"><strong>API Server:<\/strong> The API server is yet another important component of the Kubernetes. It server Kubernetes using JSON, over HTTP. The API can provide for both the internal and external interface to Kubernetes. <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\"><strong>Scheduler: <\/strong>A schedule is a pluggable component which selects which node an unscheduled pod will run on, based upon the resource availability. It is the duty of the scheduler to make sure that the workload is not scheduled in excess of the available resources.\u00a0<\/span><\/li>\n<li class=\"li3\"><span class=\"s1\"><strong>Controller Manager:<\/strong> A controller is a reconciliation loop, that works to drive actual cluster state towards the desired cluster state. It is ensured by the management of the set of controllers. <\/span><\/li>\n<\/ol>\n<ul class=\"ul1\" style=\"text-align: justify;\">\n<li class=\"li3\">\n<h4><span class=\"s1\">Add-ons:<\/span><\/h4>\n<\/li>\n<\/ul>\n<p class=\"p5\" style=\"text-align: justify;\"><span class=\"s1\">The add ons are run through pods and services, and they operate just like any other application that is running in a cluster. The only underlying difference here is that they implement the features of Kubernetes cluster. The few important add ons are: <\/span><\/p>\n<ol class=\"ol1\" style=\"text-align: justify;\">\n<li class=\"li3\"><span class=\"s1\">DNS<\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Web UI<\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Container resource monitoring <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Cluster-level logging<\/span><\/li>\n<\/ol>\n<blockquote><p>Kubernetes certifications are among the top 5 DevOps certifications. Read our previous blog to know about <a href=\"https:\/\/www.whizlabs.com\/blog\/best-devops-certifications\/\" target=\"_blank\" rel=\"noopener noreferrer\">Top DevOps Certifications<\/a>.<\/p><\/blockquote>\n<h3 class=\"p3\" style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"What_are_the_Uses_of_Kubernetes\"><\/span><span class=\"s1\">What are the Uses of Kubernetes?<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">The production of real apps can span across multiple containers. These containers need to be deployed across multiple server hosts. Here, the problem arises that of the security for containers being multi-layered and complicated. Kubernetes come to the rescue here. It easily provides the management capabilities and orchestration which is required to deploy the containers at a scale. The orchestration allows one to build application services that can span over multiple containers, schedule these containers over clusters, scale these containers, and manage the health of these containers as well. By learning Kubernetes and using them, you can easily ensure IT security.<\/span><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">For better functioning, Kubernetes needs to be integrated with various other components as well. They are storage, network, security, telemetry, and many others. Only then it can provide a comprehensive and complete infrastructure.<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-71857\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Uses-of-kubernetes.png\" alt=\"Uses Kubernetes\" width=\"700\" height=\"303\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Uses-of-kubernetes.png 601w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Uses-of-kubernetes-300x130.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">Kubernetes can also fix many problems with container proliferation. It refers to the sorting of containers together in a pod. The pod adds a layer of abstraction to the grouped containers, which can help in scheduling workload and providing necessary services to these containers, like storage and network. Other components of the Kubernetes can help with loading the balance across these pods. They make sure that you have the right number of containers which are running to support the workloads. <\/span><\/p>\n<h3 class=\"p3\" style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"What_are_the_Advantages_of_Kubernetes\"><\/span><span class=\"s1\">What are the Advantages of Kubernetes? <\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">With the introduction of Kubernetes, the developers enjoy many benefits. Majorly, it provides the platform to schedule and also runs a container on clusters of physical or virtual machines. Furthermore, it can also help in fully implementing and relying on the container based infrastructure. Since the Kubernetes runs on automation od the operational tasks, it allows you to do the same things like other platforms, but for the containers. <\/span><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><strong><span class=\"s1\">Some major advantages to learn Kubernetes are:<\/span><\/strong><\/p>\n<ul class=\"ul1\" style=\"text-align: justify;\">\n<li class=\"li3\"><span class=\"s1\">Make better use of the hardware to maximize the resources needed to run enterprise apps<\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Orchestrate containers over multiple hosts <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Mount or add storage to run apps<\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Control and automate application deployment <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Scale the containerized applications <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Health check and also self-heal the apps<span class=\"Apple-converted-space\">\u00a0 \u00a0<\/span><\/span><\/li>\n<\/ul>\n<h3 class=\"p3\" style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"How_to_Learn_Kubernetes\"><\/span><span class=\"s1\">How to Learn Kubernetes?<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">If you pose a keen interest in learning Kubernetes, and to make use of the technology, you can avail proper tutorials. The tutorial covers all the basic of the Kubernetes orchestration systems. It includes a few modules which contain background information about the features, concepts, and also offers an interactive online study material. This tutorial will help a candidate to lean Kubernetes, and master the task of managing a simple cluster, and also the containerized applications. <\/span><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><strong><span class=\"s1\">The online tutorials teach about:<\/span><\/strong><\/p>\n<ul class=\"ul1\" style=\"text-align: justify;\">\n<li class=\"li3\"><span class=\"s1\">Deploying a containerized application on a cluster<\/span><\/li>\n<li class=\"li3\"><span class=\"s1\"> Scale the deployment <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Update the application with a new version of the software <\/span><\/li>\n<li class=\"li3\"><span class=\"s1\">Debug the containerized application<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Let us also see how to deploy Kubernetes clusters on MacOS using &#8220;minikube&#8221; which is intended for the development purpose.\u00a0<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"What_is_Minikube\"><\/span>What is Minikube<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Minikube is a utility allowing you to run Kubernetes(K8s) on the local machine. Minikube runs a single node cluster on the local machine so that we can try Kubernetes locally while developing the applications. Minikube is useful for those who are new to K8s and it enables you to try out Kubernetes deployments and test configurations.\u00a0<\/span><\/p>\n<h4>Kubernetes Basics<\/h4>\n<p><span style=\"font-weight: 400;\">Let us recollect some of the basics before starting to install the minikube.<\/span><\/p>\n<h4>How to install Minikube?<\/h4>\n<p><em>Step 1:\u00a0<\/em><\/p>\n<p><span style=\"font-weight: 400;\">Run the following command to check if virtualization is supported on the MacOS.\u00a0<\/span><\/p>\n<p><strong>sysctl -a | grep machdep.cpu.features<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82211 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/check_hypervisor.png\" alt=\"check hypervisor command\" width=\"966\" height=\"302\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/check_hypervisor.png 966w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/check_hypervisor-300x94.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/check_hypervisor-768x240.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/check_hypervisor-640x200.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/check_hypervisor-681x213.png 681w\" sizes=\"(max-width: 966px) 100vw, 966px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">If you see the VMX in the output, the virtualization feature is enabled on your system.\u00a0<\/span><\/p>\n<p><em>Step 2:\u00a0<\/em><\/p>\n<p><span style=\"font-weight: 400;\">We need to install <strong>kubectl<\/strong>. If you have already installed it, please confirm by running the command:<\/span><\/p>\n<p><strong>kubectl version<\/strong><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-82214 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl_version_cmd.png\" alt=\"kubectl version cmd\" width=\"969\" height=\"261\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl_version_cmd.png 969w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl_version_cmd-300x81.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl_version_cmd-768x207.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl_version_cmd-640x172.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl_version_cmd-681x183.png 681w\" sizes=\"(max-width: 969px) 100vw, 969px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">If not, install the kubectl by running the following command:<\/span><\/p>\n<p><strong>brew install kubectl<\/strong><\/p>\n<p><em>Step 3:\u00a0<\/em><\/p>\n<p><span style=\"font-weight: 400;\">In this step, we will install Hypervisor. Various hypervisors are available, install any of the following.\u00a0<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">Hyperkit<\/span><\/li>\n<li><span style=\"font-weight: 400;\">VirtualBox<\/span><\/li>\n<li><span style=\"font-weight: 400;\">VMware Fusion<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Run the following command to install the Hyperkit.<\/span><\/p>\n<p><strong>brew install hyperkit<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82216 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-hyperkit-cmd.png\" alt=\"install hyperkit cmd\" width=\"967\" height=\"457\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-hyperkit-cmd.png 967w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-hyperkit-cmd-300x142.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-hyperkit-cmd-768x363.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-hyperkit-cmd-889x420.png 889w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-hyperkit-cmd-640x302.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-hyperkit-cmd-681x322.png 681w\" sizes=\"(max-width: 967px) 100vw, 967px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">To verify that we have installed both kubectl and hyperkit, let\u2019s run the following command.\u00a0<\/span><\/p>\n<p><strong>brew list<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82217 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-list-cmd.png\" alt=\"brew list cmd\" width=\"909\" height=\"363\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-list-cmd.png 909w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-list-cmd-300x120.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-list-cmd-768x307.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-list-cmd-640x256.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-list-cmd-681x272.png 681w\" sizes=\"(max-width: 909px) 100vw, 909px\" \/><\/p>\n<p><em>Step 4:\u00a0<\/em><\/p>\n<p><span style=\"font-weight: 400;\">We have installed the necessary tools. Now, let\u2019s install the minikube. Run the following command to install the minikube on MacOS.<\/span><\/p>\n<p><strong>brew install minikube<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82218 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-install-minikube-cmd.png\" alt=\"brew install minikube cmd\" width=\"966\" height=\"392\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-install-minikube-cmd.png 966w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-install-minikube-cmd-300x122.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-install-minikube-cmd-768x312.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-install-minikube-cmd-640x260.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/brew-install-minikube-cmd-681x276.png 681w\" sizes=\"(max-width: 966px) 100vw, 966px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Run the following command to make sure the minikue is installed successfully.<\/span><\/p>\n<p><strong>minikube version<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82219 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-version-cmd.png\" alt=\"minikube version cmd\" width=\"968\" height=\"327\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-version-cmd.png 968w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-version-cmd-300x101.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-version-cmd-768x259.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-version-cmd-640x216.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-version-cmd-681x230.png 681w\" sizes=\"(max-width: 968px) 100vw, 968px\" \/><\/p>\n<p><em>Step 6:\u00a0<\/em><\/p>\n<p><span style=\"font-weight: 400;\">We have successfully installed the minikube. Let\u2019s start the minikube by running the following command.\u00a0<\/span><\/p>\n<p><strong>minikube start<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82220 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-start-cmd.png\" alt=\"minikube start cmd\" width=\"967\" height=\"535\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-start-cmd.png 967w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-start-cmd-300x166.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-start-cmd-768x425.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-start-cmd-759x420.png 759w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-start-cmd-640x354.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-start-cmd-681x377.png 681w\" sizes=\"(max-width: 967px) 100vw, 967px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">We can verify the status of minikube by running the following command.\u00a0<\/span><\/p>\n<p><strong>minikube status<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82222 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-status-cmd.png\" alt=\"minikube status cmd\" width=\"911\" height=\"369\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-status-cmd.png 911w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-status-cmd-300x122.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-status-cmd-768x311.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-status-cmd-640x259.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/minikube-status-cmd-681x276.png 681w\" sizes=\"(max-width: 911px) 100vw, 911px\" \/><\/p>\n<p>Now, we have successfully installed Minikube and are ready to play with Kubernetes local cluster.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"How_to_install_Kubernetes_on_Ubuntu_with_kubeadm\"><\/span>How to install Kubernetes on Ubuntu with kubeadm<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">In this tutorial, we will see how to install Kubernetes on Ubuntu 20.04.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Kubernetes works on various cloud platforms or even on-premise servers. K8s works by managing clusters at scale. A cluster is a set of hosts running containerized applications and services.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">For this tutorial, I have created two Ubuntu EC2 instances on Amazon Web Services (AWS). You can utilize <\/span><a href=\"http:\/\/whizlabs.com\/labs\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">Whizlabs HandsOn Labs<\/span><\/a><span style=\"font-weight: 400;\"> platform to create instances and learn to install Kubernetes.<\/span><\/p>\n<h3><span class=\"ez-toc-section\" id=\"Prerequisites_before_installing_Kubernetes_on_Ubuntu\"><\/span>Prerequisites before installing Kubernetes on Ubuntu<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">2 or more Ubuntu 20.04 Linux servers. The minimum system requirements for Kubernetes is 2CPUs and 2 GB of RAM<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">SSH access to the servers with root privileges<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">One server will act as a master node and the other will act as a worker node.\u00a0<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Both servers needs to be able to connect with each other<\/span><\/li>\n<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Docker installed on both of the nodes. (If you don\u2019t have the Docker installed, you can follow this article and install Docker container to proceed further)<\/span><\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Installing_Kubernetes_on_Ubuntu_2004\"><\/span>Installing Kubernetes on Ubuntu 20.04<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><span style=\"font-weight: 400;\">I assume that you have the above set up and ready to install kubernetes on it. Let\u2019s see the steps involved in installing kubernetes. Please remember that the following steps need to be run on both the Ubuntu nodes.\u00a0<\/span><\/p>\n<h4>Step 1: Install Packages<\/h4>\n<p><span style=\"font-weight: 400;\">Connect to the nodes using SSH connection and run the following commands one by one on both systems.\u00a0<\/span><\/p>\n<p><b>sudo apt install apt-transport-https curl<\/b><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82316 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/apt-transport-cmd.png\" alt=\"apt transport cmd\" width=\"943\" height=\"442\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/apt-transport-cmd.png 943w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/apt-transport-cmd-300x141.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/apt-transport-cmd-768x360.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/apt-transport-cmd-896x420.png 896w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/apt-transport-cmd-640x300.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/apt-transport-cmd-681x319.png 681w\" sizes=\"(max-width: 943px) 100vw, 943px\" \/><\/p>\n<p><b>echo &#8220;deb https:\/\/apt.kubernetes.io\/ kubernetes-xenial main&#8221; &gt;&gt; ~\/kubernetes.list sudo mv ~\/kubernetes.list \/etc\/apt\/sources.list.d<\/b><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82318 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-deb-cmd.png\" alt=\"kube deb cmd\" width=\"1214\" height=\"511\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-deb-cmd.png 1214w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-deb-cmd-300x126.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-deb-cmd-1024x431.png 1024w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-deb-cmd-768x323.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-deb-cmd-998x420.png 998w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-deb-cmd-640x269.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-deb-cmd-681x287.png 681w\" sizes=\"(max-width: 1214px) 100vw, 1214px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">After running the above commands, let&#8217;s update the nodes once.\u00a0<\/span><\/p>\n<p><b>sudo apt update<\/b><\/p>\n<h4>Step 2: Install Kubernetes Tools<\/h4>\n<p><span style=\"font-weight: 400;\">In this step, we will be installing the kubernetes tools kubectl, kubeadm, kubelet, kubernetes-cni on both the nodes.\u00a0<\/span><\/p>\n<p><b>Installing Kubectl<\/b><span style=\"font-weight: 400;\">\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The kubectl is the kubernetes command line tool that allows us to run the commands inside a cluster.\u00a0<\/span><\/p>\n<p><b>sudo apt install kubectl<\/b><\/p>\n<p><span style=\"font-weight: 400;\">If you get the error, try running the command apt-get-update and then run this command again.<\/span><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82319 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl-install-error.png\" alt=\"kubectl install error\" width=\"950\" height=\"103\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl-install-error.png 950w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl-install-error-300x33.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl-install-error-768x83.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl-install-error-640x69.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubectl-install-error-681x74.png 681w\" sizes=\"(max-width: 950px) 100vw, 950px\" \/><\/p>\n<p>On a successful install, you&#8217;ll get the below message on the terminal.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82320 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/Install-kubectl.png\" alt=\"Install-kubectl\" width=\"977\" height=\"205\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/Install-kubectl.png 977w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/Install-kubectl-300x63.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/Install-kubectl-768x161.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/Install-kubectl-640x134.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/Install-kubectl-681x143.png 681w\" sizes=\"(max-width: 977px) 100vw, 977px\" \/><\/p>\n<p><b>Installing Kubeadm<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Kubectl is a tool developed and maintained by the official Kubernetes(K8s) community. Kubeadm helps setting up a minimum viable kubernetes cluster without much complex configuration.<\/span><\/p>\n<p><b>sudo apt install kubeadm<\/b><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82321 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-kubeadm-cmd.png\" alt=\"install kubeadm cmd\" width=\"962\" height=\"522\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-kubeadm-cmd.png 962w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-kubeadm-cmd-300x163.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-kubeadm-cmd-768x417.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-kubeadm-cmd-774x420.png 774w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-kubeadm-cmd-640x347.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/install-kubeadm-cmd-681x370.png 681w\" sizes=\"(max-width: 962px) 100vw, 962px\" \/><\/p>\n<p><b>Installing Kubelet<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Kubelet is an agent that will be running on each node and handles the communication between the master node and worker nodes.<\/span><\/p>\n<p><b>sudo apt install kubelet<\/b><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82322 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubelet-install-cmd.png\" alt=\"kubelet install cmd\" width=\"958\" height=\"408\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubelet-install-cmd.png 958w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubelet-install-cmd-300x128.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubelet-install-cmd-768x327.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubelet-install-cmd-640x273.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kubelet-install-cmd-681x290.png 681w\" sizes=\"(max-width: 958px) 100vw, 958px\" \/><\/p>\n<p><b>Installing kubernetes-cni<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The kubernetes-cni enables the networking and communication between the containers.\u00a0<\/span><\/p>\n<p><b>sudo apt-get install -y kubernetes-cni<\/b><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82323 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-cni-cmd.png\" alt=\"kube-cni cmd\" width=\"961\" height=\"458\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-cni-cmd.png 961w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-cni-cmd-300x143.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-cni-cmd-768x366.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-cni-cmd-881x420.png 881w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-cni-cmd-640x305.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/kube-cni-cmd-681x325.png 681w\" sizes=\"(max-width: 961px) 100vw, 961px\" \/><\/p>\n<p><b>Step 3: Setting up the hostnames<\/b><\/p>\n<p><span style=\"font-weight: 400;\">For easier identification, we can set unique hostnames to the nodes. For this tutorial, I have named the nodes as <\/span><b>whizlabs-master<\/b><span style=\"font-weight: 400;\"> and <\/span><b>whizlabs-worker.\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400;\">You can set the hostnames as you wish by running the following command.\u00a0<\/span><\/p>\n<p><b>sudo hostnamectl set-hostname whizlabs-master<\/b><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82324 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-hostname-master-cmd.png\" alt=\"set hostname master cmd\" width=\"964\" height=\"367\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-hostname-master-cmd.png 964w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-hostname-master-cmd-300x114.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-hostname-master-cmd-768x292.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-hostname-master-cmd-640x244.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-hostname-master-cmd-681x259.png 681w\" sizes=\"(max-width: 964px) 100vw, 964px\" \/><\/p>\n<p>To set the hostnames for the worker, run the following command.<\/p>\n<p><b>sudo hostnamectl set-hostname whizlabs-worker<\/b><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82325 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-host-worker-cmd.png\" alt=\"set host worker cmd\" width=\"779\" height=\"304\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-host-worker-cmd.png 779w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-host-worker-cmd-300x117.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-host-worker-cmd-768x300.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-host-worker-cmd-640x250.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/set-host-worker-cmd-681x266.png 681w\" sizes=\"(max-width: 779px) 100vw, 779px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Make sure you run these commands on respective machines. Run the first command on the node which you want to use as a master and the second on a worker node.<\/span><\/p>\n<p><b>Step 4: Disable swap memory<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The swap memory must be disabled on all the nodes to run kubernetes.\u00a0<\/span><\/p>\n<p><b>sudo swapoff -a<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The above command will disable the swap memory temporarily or until the system reboot. We can permanently disable the swap memory by making the changes to fstab file.\u00a0<\/span><\/p>\n<p><b>Step 5: Let Iptables see bridged traffic<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Run the following commands one by one. We need to set the value to 1 for the master and worker nodes to correctly see bridged traffic.\u00a0<\/span><\/p>\n<p><b>lsmod | grep br_netfilter<\/b><\/p>\n<p><b>sudo modprobe br_netfilter<\/b><\/p>\n<p><b>sudo sysctl net.bridge.bridge-nf-call-iptables=1<\/b><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82326 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/bridge-traffic-cmd.png\" alt=\"bridge traffic cmd\" width=\"882\" height=\"432\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/bridge-traffic-cmd.png 882w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/bridge-traffic-cmd-300x147.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/bridge-traffic-cmd-768x376.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/bridge-traffic-cmd-858x420.png 858w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/bridge-traffic-cmd-640x313.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/bridge-traffic-cmd-681x334.png 681w\" sizes=\"(max-width: 882px) 100vw, 882px\" \/><\/p>\n<p><b>Step 6: Docker driver setup\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Kubernetes recommends that the docker should run with <\/span><b>systemd<\/b><span style=\"font-weight: 400;\"> as the driver.\u00a0<\/span><\/p>\n<p><strong>sudo mkdir \/etc\/docker\u00a0<\/strong><\/p>\n<p><strong>cat &lt;&lt;EOF | sudo tee \/etc\/docker\/daemon.json\u00a0<\/strong><\/p>\n<p><strong>{ &#8220;exec-opts&#8221;: [&#8220;native.cgroupdriver=systemd&#8221;],\u00a0<\/strong><\/p>\n<p><strong>&#8220;log-driver&#8221;: &#8220;json-file&#8221;,\u00a0<\/strong><\/p>\n<p><strong>&#8220;log-opts&#8221;: { &#8220;max-size&#8221;: &#8220;100m&#8221; },\u00a0<\/strong><\/p>\n<p><strong>&#8220;storage-driver&#8221;: &#8220;overlay2&#8221;\u00a0<\/strong><\/p>\n<p><strong>}\u00a0<\/strong><\/p>\n<p><strong>EOF<\/strong><\/p>\n<p><span style=\"font-weight: 400;\">Also run the following commands to enable docker on the system bootup.<\/span><\/p>\n<p><b>sudo systemctl enable docker<\/b><\/p>\n<p><b>sudo systemctl daemon-reload<\/b><\/p>\n<p><b>sudo systemctl restart docker<\/b><\/p>\n<p><img decoding=\"async\" class=\"aligncenter wp-image-82327 size-full\" src=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/enable-docker-cmd.png\" alt=\"enable docker cmd\" width=\"881\" height=\"395\" srcset=\"https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/enable-docker-cmd.png 881w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/enable-docker-cmd-300x135.png 300w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/enable-docker-cmd-768x344.png 768w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/enable-docker-cmd-640x287.png 640w, https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2022\/05\/enable-docker-cmd-681x305.png 681w\" sizes=\"(max-width: 881px) 100vw, 881px\" \/><\/p>\n<p><b>Step 7: Initialize the Kubernetes Master Node<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Run the following command on the master node.<\/span><\/p>\n<p><b>sudo kubeadm init &#8211;pod-network-cidr=10.1.0.0\/16<\/b><\/p>\n<p><b>Step 8: Deploying a POD network<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Let us check the firewall status and deploy a POD network. The default port for the kubernetes is 6443. So, we need to add a firewall rule on the both master and worker nodes to allow 6443. Run the following command to add firewall rules.<\/span><\/p>\n<p><b>sudo ufw allow 6443\u00a0<\/b><\/p>\n<p><b>sudo ufw allow 6443\/tcp<\/b><\/p>\n<p><span style=\"font-weight: 400;\">To deploy a pod network, run the following commands on the master node.<\/span><\/p>\n<p><b>\u200b\u200bkubectl apply -f https:\/\/raw.githubusercontent.com\/coreos\/flannel\/master\/Documentation\/kube-flannel.yml<\/b><\/p>\n<p><b>kubectl apply -f https:\/\/raw.githubusercontent.com\/coreos\/flannel\/master\/Documentation\/k8s-manifests\/kube-flannel-rbac.yml<\/b><\/p>\n<p><span style=\"font-weight: 400;\">To check if all the services are running as expected, run the following command:<\/span><\/p>\n<p><b>kubectl get pods &#8211;all-namespaces<\/b><\/p>\n<p><b>Step 9: Join worker nodes to the cluster<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Now, we have one master node and one worker node. Login to the worker node and run the following command:<\/span><\/p>\n<p><b>sudo kubeadm join 127.0.0.188:6443 &#8211;token u81y02.91gqwkxx6rnhnnly &#8211;discovery-token-ca-cert-hash sha256:4482ab1c66bf17992ea02c1ba580f4af9f3ad4cc37b24f189db34d6e3fe95c2d<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Now, go back to the master node and check if the worker node is showing on the cluster.\u00a0<\/span><\/p>\n<p><b>kubectl get nodes<\/b><\/p>\n<p><span style=\"font-weight: 400;\">We have successfully set up the kubernetes cluster. Our cluster is now ready to run the applications on it. You can now start creating the kubernetes deployments and test the applications in real time.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">To try a sample application deployment, you can run the following command to deploy the nginx web server.\u00a0<\/span><\/p>\n<p><b>kubectl create deployment nginx &#8211;image=nginx<\/b><\/p>\n<p><span style=\"font-weight: 400;\">The above command will deploy the application. To make the service accessible to the internet, we need to create a service. For that, we need to run the following command to expose the port 80.<\/span><\/p>\n<p><b>kubectl create service nodeport nginx &#8211;tcp=80:80<\/b><\/p>\n<p>Try these commands and learn to install Kubernetes on Ubuntu 20.04 .<\/p>\n<h3 class=\"p3\" style=\"text-align: justify;\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span><span class=\"s1\">Summary<\/span><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">Though the concept of containers has existed for over a decade now, its popularity is only recent. Mainstream Unix-based operating systems had built-in support for the containers, but it was truly only Docker that could democratize the containers by making them accessible and manageable. Kubernetes is based on 15 years worth of experience of running production workloads at Google. <\/span><\/p>\n<p class=\"p3\" style=\"text-align: justify;\"><span class=\"s1\">The container orchestration has significantly impacted each and every aspect of the modern day software development and deployment. Kubernetes plays a major role in driving the adoption of containers in both successful enterprises as well as emerging startups.\u00a0<\/span><\/p>\n<p>If you want to learn Kubernetes and give your DevOps career a new edge, join <a href=\"https:\/\/www.whizlabs.com\/learn-kubernetes-with-aws-and-docker\/\" target=\"_blank\" rel=\"noopener noreferrer\">Kubernetes online course<\/a> and become an expert on Kubernetes with AWS and Docker.<\/p>\n<p><em>Have any questions? Just write in the comment section below or submit at <a href=\"https:\/\/help.whizlabs.com\/hc\/en-us\/requests\/new\" target=\"_blank\" rel=\"noopener noreferrer\">Whizlabs Helpdesk<\/a>, we&#8217;ll be happy to answer you.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog post is all about Kubernetes which is an open-source platform that helps to manage container workloads in Cloud. Here, In this Kubernetes Tutorial, we help you to learn Kubernetes from the scratch. Kubernetes has emerged as one of the most exciting technologies in the world of DevOps that has gained a lot of attention of the DevOps professionals. Kubernetes, or commonly known as k8s, is an open-source, portable and extensible platform, for managing containerized workload and services. This container orchestration system is put to automating the deployment, scaling, as well as management of the application. As one of [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":71876,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1862],"tags":[1943,1942,1944,1945],"class_list":["post-71826","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","tag-how-kubernetes-works","tag-introduction-to-kubernetes","tag-kubernetes-architecture","tag-learning-kubernetes"],"uagb_featured_image_src":{"full":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",600,315,false],"thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes-150x150.png",150,150,true],"medium":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes-300x158.png",300,158,true],"medium_large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",600,315,false],"large":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",600,315,false],"1536x1536":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",600,315,false],"2048x2048":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",600,315,false],"profile_24":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",24,13,false],"profile_48":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",48,25,false],"profile_96":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",96,50,false],"profile_150":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",150,79,false],"profile_300":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",300,158,false],"tptn_thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes-250x250.png",250,250,true],"web-stories-poster-portrait":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",600,315,false],"web-stories-publisher-logo":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",96,50,false],"web-stories-thumbnail":["https:\/\/www.whizlabs.com\/blog\/wp-content\/uploads\/2019\/05\/Introduction_to_kubernetes.png",150,79,false]},"uagb_author_info":{"display_name":"Dharmalingam N","author_link":"https:\/\/www.whizlabs.com\/blog\/author\/dharmalingam\/"},"uagb_comment_info":13,"uagb_excerpt":"This blog post is all about Kubernetes which is an open-source platform that helps to manage container workloads in Cloud. Here, In this Kubernetes Tutorial, we help you to learn Kubernetes from the scratch. Kubernetes has emerged as one of the most exciting technologies in the world of DevOps that has gained a lot of&hellip;","_links":{"self":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/71826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/comments?post=71826"}],"version-history":[{"count":19,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/71826\/revisions"}],"predecessor-version":[{"id":82452,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/posts\/71826\/revisions\/82452"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media\/71876"}],"wp:attachment":[{"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/media?parent=71826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/categories?post=71826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.whizlabs.com\/blog\/wp-json\/wp\/v2\/tags?post=71826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}