{"id":3413,"date":"2023-05-28T14:46:47","date_gmt":"2023-05-28T11:46:47","guid":{"rendered":"https:\/\/www.virtono.com\/community\/?p=3413"},"modified":"2023-06-21T08:37:33","modified_gmt":"2023-06-21T05:37:33","slug":"how-to-install-and-configure-kubernetes-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-kubernetes-on-ubuntu-22-04\/","title":{"rendered":"How to install and configure Kubernetes on Ubuntu 22.04"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Welcome to our comprehensive guide on installing and configuring Kubernetes on Ubuntu 22. In this tutorial, we will walk you through the process of setting up a Kubernetes cluster on your Ubuntu 22 machine. Whether you are a beginner or an experienced user, this guide will provide you with detailed instructions and code snippets to successfully install and configure Kubernetes.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_73 counter-hierarchy ez-toc-counter ez-toc-light-blue 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: #999;color:#999\" 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: #999;color:#999\" 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-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-kubernetes-on-ubuntu-22-04\/#Section_1_Prerequisites\" title=\"Section 1: Prerequisites\">Section 1: Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-kubernetes-on-ubuntu-22-04\/#Section_2_Installing_Docker\" title=\"Section 2: Installing Docker\">Section 2: Installing Docker<\/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.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-kubernetes-on-ubuntu-22-04\/#Section_3_Installing_Kubernetes_on_Ubuntu_2204\" title=\"Section 3: Installing Kubernetes on Ubuntu 22.04\">Section 3: Installing Kubernetes on Ubuntu 22.04<\/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.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-kubernetes-on-ubuntu-22-04\/#Section_4_Configuring_Kubernetes_on_Ubuntu_2204\" title=\"Section 4: Configuring Kubernetes on Ubuntu 22.04\">Section 4: Configuring Kubernetes on Ubuntu 22.04<\/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.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-kubernetes-on-ubuntu-22-04\/#Section_5_Deploying_Applications_on_Kubernetes\" title=\"Section 5: Deploying Applications on Kubernetes\">Section 5: Deploying Applications on Kubernetes<\/a><\/li><\/ul><\/nav><\/div>\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Section_1_Prerequisites\"><\/span>Section 1: Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before we begin the installation process, let&#8217;s ensure that your system meets the necessary prerequisites. To follow this tutorial, you will need:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/virtono.com\/cloud-vps\" target=\"_blank\" rel=\"noopener\">A machine running Ubuntu 22<\/a> (the latest LTS version).<\/li>\n\n\n\n<li>Administrative access to your Ubuntu 22 machine.<\/li>\n\n\n\n<li>Basic familiarity with the command line.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Section_2_Installing_Docker\"><\/span>Section 2: Installing Docker<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Kubernetes relies on containerization, and Docker is the most popular containerization platform. Let&#8217;s start by installing Docker on your Ubuntu 22 machine. Follow these steps:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1: Update your system&#8217;s package index.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Install Docker from the official Docker repository.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>sudo apt install docker.io<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"294\" data-attachment-id=\"3414\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-kubernetes-on-ubuntu-22-04\/attachment\/screenshot-2023-05-23-at-14-59-21\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-14.59.21.png?fit=1746%2C684&amp;ssl=1\" data-orig-size=\"1746,684\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-05-23-at-14.59.21\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-14.59.21.png?fit=750%2C294&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-14.59.21.png?resize=750%2C294&#038;ssl=1\" alt=\"Kubernetes on Ubuntu\" class=\"wp-image-3414\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-14.59.21.png?resize=1024%2C401&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-14.59.21.png?resize=300%2C118&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-14.59.21.png?resize=768%2C301&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-14.59.21.png?resize=1536%2C602&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-14.59.21.png?w=1746&amp;ssl=1 1746w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Step 3: Start and enable the Docker service.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>sudo systemctl start docker<br>sudo systemctl enable docker<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4: Verify the installation by running a test container.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>sudo docker run hello-world<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"541\" data-attachment-id=\"3415\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-kubernetes-on-ubuntu-22-04\/attachment\/screenshot-2023-05-23-at-15-00-24\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.00.24.png?fit=1600%2C1154&amp;ssl=1\" data-orig-size=\"1600,1154\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-05-23-at-15.00.24\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.00.24.png?fit=750%2C541&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.00.24.png?resize=750%2C541&#038;ssl=1\" alt=\"Kubernetes on Ubuntu hello-world\" class=\"wp-image-3415\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.00.24.png?resize=1024%2C739&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.00.24.png?resize=300%2C216&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.00.24.png?resize=768%2C554&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.00.24.png?resize=1536%2C1108&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.00.24.png?w=1600&amp;ssl=1 1600w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Section_3_Installing_Kubernetes_on_Ubuntu_2204\"><\/span>Section 3: Installing Kubernetes on Ubuntu 22.04<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once Docker is installed and configured, we can proceed with the installation of Kubernetes on Ubuntu 22.04. Kubernetes uses various components to manage and orchestrate containers. Follow these steps to install Kubernetes on Ubuntu 22:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1: Add the Kubernetes on Ubuntu 22.04 repository and import the repository&#8217;s GPG key.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>curl -s https:\/\/packages.cloud.google.com\/apt\/doc\/apt-key.gpg | sudo gpg --dearmour -o \/etc\/apt\/trusted.gpg.d\/kubernetes-xenial.gpg<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Add the Kubernetes repository.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>sudo apt-add-repository \"deb http:\/\/apt.kubernetes.io\/ kubernetes-xenial main\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Step 3: Install the necessary packages for Kubernetes.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>sudo apt update\nsudo apt install kubeadm kubelet kubectl\nsudo apt-mark hold kubelet kubeadm kubectl<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4: Initialize the Kubernetes on Ubuntu 22.04 cluster using the kubeadm tool.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>sudo swapoff -a\nsudo sed -i '\/ swap \/ s\/^\\(.*\\)$\/#\\1\/g' \/etc\/fstab\nsudo kubeadm init<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"276\" data-attachment-id=\"3416\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-kubernetes-on-ubuntu-22-04\/attachment\/screenshot-2023-05-23-at-15-21-17\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.21.17.png?fit=1918%2C706&amp;ssl=1\" data-orig-size=\"1918,706\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-05-23-at-15.21.17\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.21.17.png?fit=750%2C276&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.21.17.png?resize=750%2C276&#038;ssl=1\" alt=\"install and configure Kubernetes\" class=\"wp-image-3416\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.21.17.png?resize=1024%2C377&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.21.17.png?resize=300%2C110&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.21.17.png?resize=768%2C283&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.21.17.png?resize=1536%2C565&amp;ssl=1 1536w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.21.17.png?w=1918&amp;ssl=1 1918w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Step 5: Configure your user account to access the cluster as a non-root user.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>mkdir -p $HOME\/.kube\nsudo cp -i \/etc\/kubernetes\/admin.conf $HOME\/.kube\/config\nsudo chown $(id -u):$(id -g) $HOME\/.kube\/config<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Section_4_Configuring_Kubernetes_on_Ubuntu_2204\"><\/span>Section 4: Configuring Kubernetes on Ubuntu 22.04<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After successfully installing Kubernetes on Ubuntu 22.04, it&#8217;s time to configure it to suit your requirements. Here are some important configurations you should consider:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><a href=\"https:\/\/virtono.com\/cloud-vps#plans\" target=\"_blank\" rel=\"noopener\">Setting up cluster<\/a>-wide DNS with CoreDNS: Kubernetes uses CoreDNS for cluster DNS management. To set it up, follow the official Kubernetes documentation.<\/li>\n\n\n\n<li>Securing your cluster with <a href=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-kubernetes-cert-manager\/\">SSL\/TLS certificates<\/a>: Protect your cluster by configuring SSL\/TLS certificates. Refer to the Kubernetes documentation for detailed instructions.<\/li>\n\n\n\n<li>Managing resource allocation and limits: Define resource requests and limits for your applications to ensure optimal performance. Use resource specifications such as CPU and memory limits in your pod configurations.<\/li>\n\n\n\n<li>Configuring persistent storage with persistent volumes: Enable persistent storage for your applications by creating persistent volumes and volume claims. This allows data to persist even if pods are restarted or rescheduled.<\/li>\n\n\n\n<li>Enabling monitoring and logging for your cluster: Install monitoring and logging solutions such as Prometheus and Elasticsearch to gain insights into your cluster&#8217;s health and troubleshoot issues effectively.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading has-accent-color has-text-color\"><span class=\"ez-toc-section\" id=\"Section_5_Deploying_Applications_on_Kubernetes\"><\/span>Section 5: Deploying Applications on Kubernetes<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">With Kubernetes on Ubuntu 22.04 up and running, you can now deploy applications onto your cluster. Here&#8217;s a simplified example of deploying a sample application:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 1: Create a deployment YAML file (e.g., <code>app-deployment.yaml<\/code>) with the desired specifications for your application. This is an example of a Nginx app:<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  replicas: 3\n  selector:\n    matchLabels:\n      app: nginx\n  template:\n    metadata:\n      labels:\n        app: nginx\n    spec:\n      containers:\n        - name: nginx\n          image: nginx:latest\n          ports:\n            - containerPort: 80<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Explanation of the YAML file:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The YAML file specifies a Deployment resource with the name &#8220;nginx-deployment&#8221;.<\/li>\n\n\n\n<li>The <code>replicas<\/code> field is set to 3, which means three instances (pods) of Nginx will be created.<\/li>\n\n\n\n<li>The <code>selector<\/code> field selects the pods to manage based on the labels. In this case, it selects pods with the label <code>app: nginx<\/code>.<\/li>\n\n\n\n<li>The <code>template<\/code> section describes the pod template used to create new pods.<\/li>\n\n\n\n<li>The <code>labels<\/code> field specifies the labels for the pods. In this case, the label <code>app: nginx<\/code> is assigned.<\/li>\n\n\n\n<li>The <code>containers<\/code> section lists the containers within the pod.<\/li>\n\n\n\n<li>The container name is set to &#8220;nginx&#8221;.<\/li>\n\n\n\n<li>The <code>image<\/code> field specifies the Nginx container image to be used. In this case, it uses the latest version of the official Nginx image.<\/li>\n\n\n\n<li>The <code>ports<\/code> section defines the port configuration for the container. In this example, port 80 is exposed.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Remember to customize the YAML file according to your application&#8217;s requirements, such as updating the deployment name, container image, ports, and any additional configuration needed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Apply the deployment to <a href=\"https:\/\/virtono.com\/cloud-vps\" target=\"_blank\" rel=\"noopener\">your cluster<\/a> using the <code>kubectl<\/code> command.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl apply -f app-deployment.yaml<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"194\" data-attachment-id=\"3417\" data-permalink=\"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-kubernetes-on-ubuntu-22-04\/attachment\/screenshot-2023-05-23-at-15-27-04\/\" data-orig-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.27.04.png?fit=1416%2C366&amp;ssl=1\" data-orig-size=\"1416,366\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"Screenshot-2023-05-23-at-15.27.04\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.27.04.png?fit=750%2C194&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.27.04.png?resize=750%2C194&#038;ssl=1\" alt=\"Nginx image deployment\" class=\"wp-image-3417\" srcset=\"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.27.04.png?resize=1024%2C265&amp;ssl=1 1024w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.27.04.png?resize=300%2C78&amp;ssl=1 300w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.27.04.png?resize=768%2C199&amp;ssl=1 768w, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-23-at-15.27.04.png?w=1416&amp;ssl=1 1416w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Step 3: Monitor the deployment and check its status.<\/p>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl get deployments\nkubectl get pods<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code has-white-color has-black-background-color has-text-color has-background\"><code>kubectl get deployments\nNAME               READY   UP-TO-DATE   AVAILABLE   AGE\nnginx-deployment   0\/3     3            0           2m14s<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Congratulations! You have successfully installed and configured Kubernetes on your Ubuntu 22 machine. You are now ready to deploy and manage your containerized applications with the power of Kubernetes. Remember to refer to the official Kubernetes documentation for more advanced topics and best practices. Happy clustering!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to our comprehensive guide on installing and configuring Kubernetes on Ubuntu 22. In this tutorial, we will walk you through the process of setting up a Kubernetes cluster on your Ubuntu 22 machine. Whether you are a beginner or an experienced user, this guide will provide you with detailed<\/p>\n","protected":false},"author":8,"featured_media":3418,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3],"tags":[416,370,417,418,419,420],"class_list":["post-3413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorial-how-to","tag-configure-kubernetes","tag-install-kubernetes","tag-install-kubernetes-ubuntu","tag-install-kubernetes-ubuntu-22-04","tag-kubernetes-on-ubuntu","tag-kubernetes-ubuntu"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/How-to-install-and-configure-Kubernetes-on-Ubuntu-22.04.png?fit=600%2C330&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7ISfL-T3","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":3641,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-redis-on-kubernetes\/","url_meta":{"origin":3413,"position":0},"title":"How to Deploy Redis on Kubernetes","author":"George B.","date":"July 25, 2023","format":false,"excerpt":"This article provides a detailed guide on how to install Redis on Kubernetes, covering everything from configuring the Kubernetes environment to installing and administering Redis. The demand for effective, scalable, and trustworthy data storage solutions has increased as the world transitions to microservices and containerized applications. Redis, a high-performance in-memory\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/07\/How-to-Deploy-Redis-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3821,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-zipkin-on-kubernetes\/","url_meta":{"origin":3413,"position":1},"title":"How to Deploy Zipkin on Kubernetes","author":"George B.","date":"September 6, 2023","format":false,"excerpt":"This tutorial will walk you through setting up Zipkin on Kubernetes, assuming that you already have K3s and Helm set up. Microservices have become a key element in the quickly changing world of software development. Distributed tracing systems like Zipkin have become very popular in tandem with this explosion in\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/09\/How-to-Deploy-Zipkin-on-k3s.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3357,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-a-local-kubernetes-with-microk8s\/","url_meta":{"origin":3413,"position":2},"title":"How to install a local Kubernetes with MicroK8s","author":"George B.","date":"May 20, 2023","format":false,"excerpt":"Fortunately, MicroK8s offers a lightweight and straightforward solution for running Kubernetes on your local machine, or on a single VPS. In this guide, we'll walk you through the step-by-step process of installing MicroK8s and getting started with local Kubernetes development. Kubernetes has become the de facto standard for container orchestration,\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/How-to-install-a-local-Kubernetes-with-MicroK8s.png?fit=600%2C330&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/How-to-install-a-local-Kubernetes-with-MicroK8s.png?fit=600%2C330&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/How-to-install-a-local-Kubernetes-with-MicroK8s.png?fit=600%2C330&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3954,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-and-configure-docker-swarm-on-ubuntu-22-04\/","url_meta":{"origin":3413,"position":3},"title":"How to Install and Configure Docker Swarm on Ubuntu 22.04","author":"George B.","date":"September 27, 2023","format":false,"excerpt":"This tutorial will show you how to install and configure Docker Swarm on Ubuntu 22.04 ensuring that you harness its full potential for your containerized applications. For effectively scaling and managing containers, Docker Swarm is still a great option. Many developers and DevOps experts prefer it because of its ease\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/09\/How-to-Install-and-Configure-Docker-Swarm-on-Ubuntu.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3708,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-deploy-jenkins-on-kubernetes\/","url_meta":{"origin":3413,"position":4},"title":"How to Deploy Jenkins on Kubernetes","author":"George B.","date":"August 2, 2023","format":false,"excerpt":"In this tutorial, we'll go into detail about how to deploy Jenkins on Kubernetes using K3s, a streamlined Kubernetes distribution ideal for edge, IoT, and small clusters. To make the process as clear as possible, this guide will offer specific, step-by-step instructions and examples. Jenkins and Kubernetes have proven to\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/08\/How-to-Deploy-Jenkins-on-Kubernetes.png?fit=360%2C240&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3425,"url":"https:\/\/www.virtono.com\/community\/tutorial-how-to\/how-to-install-krew-plugin-manager-for-kubectl-cli\/","url_meta":{"origin":3413,"position":5},"title":"How to Install Krew Plugin Manager for Kubectl CLI","author":"George B.","date":"May 30, 2023","format":false,"excerpt":"Did you know that you can enhance its functionality further with the Krew plugin manager? As a Linux user and a Kubernetes enthusiast, you understand the power and flexibility of the Kubectl CLI. Krew allows you to easily discover, install, and manage plugins for Kubectl, enabling you to streamline your\u2026","rel":"","context":"In &quot;Tutorials&quot;","block_context":{"text":"Tutorials","link":"https:\/\/www.virtono.com\/community\/category\/tutorial-how-to\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/How-to-Install-Krew-Plugin-Manager-for-Kubectl-CLI.png?fit=600%2C330&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/How-to-Install-Krew-Plugin-Manager-for-Kubectl-CLI.png?fit=600%2C330&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.virtono.com\/community\/wp-content\/uploads\/2023\/05\/How-to-Install-Krew-Plugin-Manager-for-Kubectl-CLI.png?fit=600%2C330&ssl=1&resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/comments?post=3413"}],"version-history":[{"count":2,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3413\/revisions"}],"predecessor-version":[{"id":3520,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/posts\/3413\/revisions\/3520"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media\/3418"}],"wp:attachment":[{"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/media?parent=3413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/categories?post=3413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.virtono.com\/community\/wp-json\/wp\/v2\/tags?post=3413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}