{"id":3353,"date":"2024-05-20T16:07:52","date_gmt":"2024-05-20T10:37:52","guid":{"rendered":"https:\/\/www.veeble.org\/kb\/?p=3353"},"modified":"2025-03-11T10:14:59","modified_gmt":"2025-03-11T04:44:59","slug":"how-to-install-kubernetes-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/www.veeble.com\/kb\/how-to-install-kubernetes-on-ubuntu-22-04\/","title":{"rendered":"How to Install Kubernetes on Ubuntu 22.04"},"content":{"rendered":"\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"536\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide-1024x536.jpg\" alt=\"Install Kubernetes on Ubuntu \" class=\"wp-image-3368\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide-1024x536.jpg 1024w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide-300x157.jpg 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide-768x402.jpg 768w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide.jpg 1080w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>In today&#8217;s cloud-focused environment, <a href=\"https:\/\/kubernetes.io\/\" target=\"_blank\" rel=\"noopener\">Kubernetes <\/a>has become a foundation for managing containerized applications efficiently. By utilizing this, we can access robust tools to seamlessly orchestrate and scale our applications across our infrastructure. This guide will walk you through the straightforward process of installing Kubernetes on Ubuntu 22.04<\/p>\n\n\n<div role=\"navigation\" aria-label=\"Table of Contents\" class=\"simpletoc wp-block-simpletoc-toc\"><h2 style=\"margin: 0;\"><button type=\"button\" aria-expanded=\"false\" aria-controls=\"simpletoc-content-container\" class=\"simpletoc-collapsible\">Table of Contents<span class=\"simpletoc-icon\" aria-hidden=\"true\"><\/span><\/button><\/h2><div id=\"simpletoc-content-container\" class=\"simpletoc-content\"><style>html { scroll-behavior: smooth; }<\/style><ul class=\"simpletoc-list\">\n<li><a href=\"#what-is-kubernets\">What is kubernets??<\/a>\n\n<\/li>\n<li><a href=\"#prerequisites\">Prerequisites<\/a>\n\n<\/li>\n<li><a href=\"#steps-to-install-kubernetes\">Steps To Install Kubernetes<\/a>\n\n\n<ul><li>\n<a href=\"#1-update-and-upgrade-ubuntu\">1. Update and Upgrade Ubuntu<\/a>\n\n<\/li>\n<li><a href=\"#2-install-docker\">2. Install Docker<\/a>\n\n<\/li>\n<li><a href=\"#3-install-kubernets\">3.  Install Kubernets<\/a>\n\n\n<ul><li>\n<a href=\"#1-install-snapd\">1. Install snapd<\/a>\n\n<\/li>\n<li><a href=\"#2-install-microk8s\">2: Install MicroK8s:<\/a>\n\n<\/li>\n<\/ul>\n<li><a href=\"#nbsp4-configurenbsp-kubernetes\">&nbsp;4: Configure&nbsp; Kubernetes<\/a>\n\n<\/li>\n<li><a href=\"#5-access-kubernetes-dashboard\">5: Access Kubernetes Dashboard<\/a>\n<\/li>\n<\/ul>\n<\/li><\/ul><\/div><\/div>\n\n<h2 class=\"wp-block-heading\" id=\"what-is-kubernets\">What is kubernets??<\/h2>\n\n\n<p>Kubernetes is an <a href=\"https:\/\/gcore.com\/blog\/top-10-container-orchestration-tools\/\" target=\"_blank\" rel=\"noopener\">open-source container orchestration<\/a> platform that automates the deployment, scaling, and management of containerized applications. Initially it was  developed by Google and is now maintained by the <a href=\"https:\/\/www.cncf.io\/\" target=\"_blank\" rel=\"noopener\">Cloud Native Computing Foundation (CNCF)<\/a>. Moreover, it provides a framework for automating the deployment, scaling, and management of containerized applications across a cluster of machines. It abstracts away the underlying infrastructure, allowing developers to focus on building and deploying applications without worrying about the underlying infrastructure details.<\/p>\n\n\n\n<p>Kubernetes uses a declarative model, where you specify the desired state of your applications, and it takes care of maintaining that state. Furthermore, it provides features like automatic scaling, load balancing, self-healing, and rolling updates, making it an ideal platform for deploying and managing modern, microservices-based applications.<\/p>\n\n\n<h2 class=\"wp-block-heading\" id=\"prerequisites\">Prerequisites<\/h2>\n\n\n<ol class=\"wp-block-list\">\n<li>A VPS installed with Ubuntu 22.04<\/li>\n\n\n\n<li>A root account\/user account with sudo privileges<\/li>\n<\/ol>\n\n\n<h2 class=\"wp-block-heading\" id=\"steps-to-install-kubernetes\">Steps To Install Kubernetes <\/h2>\n\n<h3 class=\"wp-block-heading\" id=\"1-update-and-upgrade-ubuntu\">1. Update and Upgrade Ubuntu<\/h3>\n\n\n<p>Updating and upgrading Ubuntu ensures that your system has the latest package information and security updates. Additionally, this step is crucial to ensure that you have the latest versions of software packages installed on your system.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@test:~# apt-get update\nroot@test:~# apt-get upgrade<\/code><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id=\"2-install-docker\">2. Install Docker<\/h3>\n\n\n<p><a href=\"https:\/\/www.docker.com\/\" target=\"_blank\" rel=\"noopener\">Docker <\/a>is a containerization platform that allows you to package and distribute applications as containers. Additionally, kubernetes relies on Docker to run containerized applications. Therefore installing Docker ensures that you have the necessary runtime environment for running Kubernetes pods.<\/p>\n\n\n\n<p>To install Docker, we have already discussed the steps in a previous article at <a>https:\/\/www.veeble.org\/kb\/how-to-install-and-use-docker-on-ubuntu\/<\/a>. Following these steps, you can easily install Docker.<\/p>\n\n\n\n<p>To verify docker is successfully installed, run the command below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@test:~#&nbsp;docker --version<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-140725.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"629\" height=\"118\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-140725.png\" alt=\"\" class=\"wp-image-3356\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-140725.png 629w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-140725-300x56.png 300w\" sizes=\"auto, (max-width: 629px) 100vw, 629px\" \/><\/a><\/figure>\n\n\n<h3 class=\"wp-block-heading\" id=\"3-install-kubernets\">3.  Install Kubernets<\/h3>\n\n<h4 class=\"wp-block-heading\" id=\"1-install-snapd\">1. Install snapd<\/h4>\n\n\n<p>First you need to install <a href=\"https:\/\/www.vuepilot.com\/support\/article\/installation-with-snap\/\" target=\"_blank\" rel=\"noopener\">snapd<\/a>. Snapd is a package manager for snaps, which are self-contained software packages. Notably, Kubernetes can be installed using snapd. Therefore, if snapd is not already installed, you should proceed to install it<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@test:~# apt-get install snapd<\/code><\/pre>\n\n\n<h4 class=\"wp-block-heading\" id=\"2-install-microk8s\">2: Install MicroK8s:<\/h4>\n\n\n<p><a href=\"https:\/\/microk8s.io\/\" target=\"_blank\" rel=\"noopener\">MicroK8s <\/a>is a lightweight Kubernetes distribution that is easy to install and manage. Install MicroK8s using snapd:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@test:~#snap install microk8s --classic<\/code><\/pre>\n\n\n<h3 class=\"wp-block-heading\" id=\"nbsp4-configurenbsp-kubernetes\"><strong> 4: Configure  Kubernetes<\/strong><\/h3>\n\n\n<p>MicroK8s provides several add-ons that enhance Kubernetes functionality. Enable the necessary add-ons for your setup.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@test:~# microk8s enable dashboard dns registry istio<\/code><\/pre>\n\n\n\n<p>Run the following command to check the status of&nbsp; MicroK8s&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@test:~# Microk8s status<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-095709.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"636\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-095709-1024x636.png\" alt=\"\" class=\"wp-image-3357\" style=\"width:618px;height:auto\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-095709-1024x636.png 1024w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-095709-300x186.png 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-095709-768x477.png 768w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-095709.png 1175w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n<h3 class=\"wp-block-heading\" id=\"5-access-kubernetes-dashboard\"><strong>5: Access Kubernetes Dashboard<\/strong><\/h3>\n\n\n<p>If you enabled the dashboard add-on, you can access the dashboard by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>root@test:~# microk8s dashboard-proxy<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121020.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"216\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121020-1024x216.png\" alt=\"\" class=\"wp-image-3358\" style=\"width:622px;height:auto\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121020-1024x216.png 1024w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121020-300x63.png 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121020-768x162.png 768w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121020-1536x324.png 1536w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121020.png 1597w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Using the following secret token we can login to the dashboard. Copy the token displayed in the output. Then access the dashboard at <a href=\"https:\/\/your\" target=\"_blank\">https:\/<\/a>\/[YOUR IP]:10443.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-130349.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"484\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-130349-1024x484.png\" alt=\"\" class=\"wp-image-3362\" style=\"width:654px;height:auto\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-130349-1024x484.png 1024w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-130349-300x142.png 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-130349-768x363.png 768w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-130349-1536x726.png 1536w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-130349.png 1651w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Next, select the option token and copy the given token. Now, you have successfully signed in to the dashboard .<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><a href=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121116-1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"588\" src=\"https:\/\/www.veeble.org\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121116-1-1024x588.png\" alt=\"\" class=\"wp-image-3363\" style=\"width:639px;height:auto\" srcset=\"https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121116-1-1024x588.png 1024w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121116-1-300x172.png 300w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121116-1-768x441.png 768w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121116-1-1536x882.png 1536w, https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Screenshot-2024-05-20-121116-1.png 1655w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>This should give you a comprehensive guide to installing Kubernetes on Ubuntu 22.04. As it is a powerful container orchestration tool widely used in modern cloud environments, using the above simple steps will allow you to easily install Kubernetes and deploy your applications.<\/p>\n\n\n\n<div style=\"height:35px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-uagb-call-to-action uagb-block-c16fa377 wp-block-button\"><div class=\"uagb-cta__wrap\"><h3 class=\"uagb-cta__title\"><strong>Your Server, Fully Managed. Zero Stress.<\/strong><\/h3><p class=\"uagb-cta__desc\">No more downtime nightmares. Our team manages patches, backups, and optimizations. Enjoy 99.9% uptime and root access. Ideal for startups and agencies.<\/p><\/div><div class=\"uagb-cta__buttons\"><a href=\"https:\/\/www.veeble.com\/in\/managed-vps\/\" class=\"uagb-cta__button-link-wrapper wp-block-button__link\" target=\"_blank\" rel=\"noopener noreferrer\">Explore Plans<svg xmlns=\"https:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path d=\"M504.3 273.6l-112.1 104c-6.992 6.484-17.18 8.218-25.94 4.406c-8.758-3.812-14.42-12.45-14.42-21.1L351.9 288H32C14.33 288 .0002 273.7 .0002 255.1S14.33 224 32 224h319.9l0-72c0-9.547 5.66-18.19 14.42-22c8.754-3.809 18.95-2.075 25.94 4.41l112.1 104C514.6 247.9 514.6 264.1 504.3 273.6z\"><\/path><\/svg><\/a><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In today&#8217;s cloud-focused environment, Kubernetes has become a foundation for managing containerized applications efficiently. By utilizing this, we can access robust tools to seamlessly [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":3368,"comment_status":"closed","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":"set","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":[3,5],"tags":[],"class_list":["post-3353","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-installation","category-linux"],"uagb_featured_image_src":{"full":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide.jpg",1080,565,false],"thumbnail":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide-150x150.jpg",150,150,true],"medium":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide-300x157.jpg",300,157,true],"medium_large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide-768x402.jpg",768,402,true],"large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide-1024x536.jpg",1024,536,true],"1536x1536":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide.jpg",1080,565,false],"2048x2048":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2024\/05\/Kubernetes-Installation-Guide.jpg",1080,565,false]},"uagb_author_info":{"display_name":"Nayana Nair","author_link":"https:\/\/www.veeble.com\/kb\/author\/nayana\/"},"uagb_comment_info":0,"uagb_excerpt":"In today&#8217;s cloud-focused environment, Kubernetes has become a foundation for managing containerized applications efficiently. By utilizing this, we can access robust tools to seamlessly [&hellip;]","_links":{"self":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/3353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/comments?post=3353"}],"version-history":[{"count":11,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/3353\/revisions"}],"predecessor-version":[{"id":7987,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/3353\/revisions\/7987"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media\/3368"}],"wp:attachment":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media?parent=3353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/categories?post=3353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/tags?post=3353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}