{"id":25443,"date":"2024-02-20T07:28:43","date_gmt":"2024-02-20T07:28:43","guid":{"rendered":"https:\/\/green.cloud\/docs\/docs\/greencloud-documents\/linux-operating-systems\/how-to-install-kubectl-on-ubuntu-22-04\/"},"modified":"2026-01-19T00:45:47","modified_gmt":"2026-01-19T00:45:47","slug":"how-to-install-kubectl-on-ubuntu-22-04","status":"publish","type":"docs","link":"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/","title":{"rendered":"How to install Kubectl on Ubuntu 22.04"},"content":{"rendered":"<p>Do you want to install\u00a0Kubernetes&#8217;\u00a0command-line tool Kubectl on Ubuntu 22.04 but are unsure how?<\/p>\n<p>This guide will show you how to install Kubectl on Ubuntu 22.04, which will enable you to interact with or execute commands on\u00a0Kubernetes clusters. By the end of this guide, you should have Kubectl installed on your system.<\/p>\n<h2><strong>What is Kubectl?<\/strong><\/h2>\n<p>Before going on to how to install Kubectl on your Ubuntu system, you need to understand what it is and why it is required. Kubectl is a command-line interface (CLI)\u00a0<a href=\"https:\/\/www.cherryservers.com\/blog\/the-complete-overview-of-devops-cloud-native-tools\">tool<\/a>\u00a0for interacting with Kubernetes clusters. It enables efficient control and management of\u00a0Kubernetes\u00a0resources.<\/p>\n<p>With Kubectl, you can deploy applications, inspect and update cluster resources at will, scale deployments, and even troubleshoot issues that surface. Consider Kubectl your bridge, seamlessly connecting you to your Kubernetes cluster, making it easy to issue commands and retrieve information.<\/p>\n<h2><strong>Prerequisites<\/strong><\/h2>\n<ul>\n<li>Basic knowledge of the Linux command-line interface (CLI)<\/li>\n<li>Ubuntu 22.04 server<\/li>\n<\/ul>\n<h2><strong>Install Kubectl on Ubuntu 22.04<\/strong><\/h2>\n<p>In this guide, we\u2019ll explore three common ways of installing Kubectl on your Ubuntu 22.04 system: installing the Kubectl binary using\u00a0<a href=\"https:\/\/www.cherryservers.com\/blog\/how-to-use-curl-to-download-files-on-linux\">curl<\/a>, the apt package manager, and the snap package manager.<\/p>\n<p><iframe title=\"How to install Kubectl on Ubuntu 22.04 | VPS Tutorial\" width=\"1170\" height=\"658\" src=\"https:\/\/www.youtube.com\/embed\/xIAlg1thDjo?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<h3><strong>Method 1 &#8211; Install Kubectl binary using curl<\/strong><\/h3>\n<p>This method involves manually downloading a release of the Kubectl binary from the official Kubernetes repository using the\u00a0curl command. This method is suitable if you prefer a specific version of Kubectl or need to install Kubectl on a system where traditional package managers are unavailable.<\/p>\n<h4>Step 1 &#8211; Download the Kubectl binary<\/h4>\n<p>First, you need to download the Kubectl binary from the official Kubernetes release repository. To do this, run the following command in your terminal:<\/p>\n<pre class=\"language-bash\" tabindex=\"0\"><code class=\"language-bash\"><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-LO<\/span> <span class=\"token string\">\"https:\/\/dl.k8s.io\/release\/<span class=\"token variable\">$(<span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-L<\/span> <span class=\"token parameter variable\">-s<\/span> https:\/\/dl.k8s.io\/release\/stable.txt)<\/span>\/bin\/linux\/amd64\/kubectl\"<\/span>\r\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_1-1.png\" alt=\"download-kubectl-binary\" \/><\/p>\n<p>This will download the latest stable Kubectl binary from the repository. If you would like to download a specific version instead, you can specify the version in the download URL.<\/p>\n<h4>Step 2 &#8211; Make the Kubectl binary executable<\/h4>\n<p>Next, you need to make the downloaded binary executable by running the following command:<\/p>\n<pre class=\"language-bash\" tabindex=\"0\"><code class=\"language-bash\"><span class=\"token function\">chmod<\/span> +x kubectl\r\n<\/code><\/pre>\n<h4>Step 3 &#8211; Move Kubectl binary to PATH<\/h4>\n<p>Run the following command to move the binary to a directory included in the system&#8217;s PATH environment variable:<\/p>\n<pre class=\"language-bash\" tabindex=\"0\"><code class=\"language-bash\"><span class=\"token function\">mv<\/span> kubectl \/usr\/local\/bin\r\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_2-1.png\" alt=\"add-kubectl-to-path\" \/><\/p>\n<p>This will make Kubectl accessible from anywhere in the terminal.<\/p>\n<h3><strong>Method 2 &#8211; Install Kubectl using apt<\/strong><\/h3>\n<p>Another method to install Kubectl on Ubuntu 22.04 is by using the apt package manager. With this method, you can easily update Kubectl and manage its dependencies.<\/p>\n<h4>Step 1 &#8211; Add Kubernetes repository&#8217;s GPG (GNU Privacy Guard) key<\/h4>\n<p>First, download the GPG key for the Kubernetes repository by running:<\/p>\n<pre class=\"language-bash\" tabindex=\"0\"><code class=\"language-bash\">curl -fsSL https:\/\/pkgs.k8s.io\/core:\/stable:\/v1.29\/deb\/Release.key | gpg --dearmor -o \/etc\/apt\/keyrings\/kubernetes-apt-keyring.gpg\r\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_6-6.png\" alt=\"add-entry-for-kubernetes-packages\" \/><\/p>\n<p>Running this command will download the GPG key, convert it to a binary format, and save it as a GPG keyring file. This keyring file is used to verify the authenticity of the packages, ensuring the genuineness of every package you install from the Kubernetes repository.<\/p>\n<h4>Step 2 &#8211; Add the Kubernetes repository to your system&#8217;s sources.list<\/h4>\n<p>Next, create a repository entry for the Kubernetes packages by executing the following in the terminal:<\/p>\n<pre class=\"language-bash\" tabindex=\"0\"><code class=\"language-bash\">echo 'deb [signed-by=\/etc\/apt\/keyrings\/kubernetes-apt-keyring.gpg] https:\/\/pkgs.k8s.io\/core:\/stable:\/v1.29\/deb\/ \/' | tee \/etc\/apt\/sources.list.d\/kubernetes.list\r\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_7-3.png\" alt=\"add-entry-for-kubernetes-packages\" \/><\/p>\n<p>This repository entry will be used by apt to fetch and install packages from the Kubernetes repository.<\/p>\n<h4>Step 3 &#8211; Update system packages<\/h4>\n<p>After adding the repository,\u00a0update the system packages:<\/p>\n<pre class=\"language-bash\" tabindex=\"0\"><code class=\"language-bash\">apt-get update\r\n<\/code><\/pre>\n<h4>Step 4 &#8211; Install Kubectl using the apt package manager<\/h4>\n<p>Now, install Kubectl using apt by running the following command:<\/p>\n<pre class=\"language-bash\" tabindex=\"0\"><code class=\"language-bash\"><span class=\"token function\">apt<\/span> <span class=\"token function\">install<\/span> kubectl\r\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_5-2.png\" alt=\"install-kubectl-using-apt\" \/><\/p>\n<h3><strong>Method 3 &#8211; Install Kubectl using Snap<\/strong><\/h3>\n<p>Snap is another package manager that can be used to install Kubectl on Ubuntu 22.04. This method is suitable if you prefer a simple installation process.<\/p>\n<h4>Step 1 &#8211; Update system packages<\/h4>\n<p>Run the following command to update the system packages:<\/p>\n<pre class=\"language-bash\" tabindex=\"0\"><code class=\"language-bash\"> apt-get update\r\n<\/code><\/pre>\n<h4>Step 2 &#8211; Install Kubectl<\/h4>\n<p>Next, to install Kubectl using Snap, run the command below:<\/p>\n<pre tabindex=\"0\">apt install snapd\r\n<code class=\"language-bash\">snap <span class=\"token function\">install<\/span> kubectl <span class=\"token parameter variable\">--classic<\/span>\r\n<\/code><\/pre>\n<h2><strong>Verify Kubectl Installation<\/strong><\/h2>\n<p>You can verify the Kubectl installation by running the following code in the terminal:<\/p>\n<pre class=\"language-bash\" tabindex=\"0\"><code class=\"language-bash\">kubectl version <span class=\"token parameter variable\">--output<\/span><span class=\"token operator\">=<\/span>yaml\r\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_6-3.png\" alt=\"confirm-installation\" \/><\/p>\n<p>This will display information about the installed Kubectl in YAML format.<\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p>You&#8217;ve learned three ways of installing Kubectl on Ubuntu 22.04, and based on your preference, you can decide to use any of them. With Kubectl up and running in your system, you can go on to explore its capabilities by going through its\u00a0documentation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you want to install\u00a0Kubernetes&#8217;\u00a0command-line tool Kubectl on Ubuntu 22.04 but are unsure how? This guide will show you how to install Kubectl on Ubuntu 22.04, which will enable you to interact with or execute commands on\u00a0Kubernetes clusters. By the end of this guide, you should have Kubectl installed on your system. What is Kubectl? [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":0,"parent":17817,"menu_order":535,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-25443","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to install Kubectl on Ubuntu 22.04 - GreenCloud Documentation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to install Kubectl on Ubuntu 22.04 - GreenCloud Documentation\" \/>\n<meta property=\"og:description\" content=\"Do you want to install\u00a0Kubernetes&#8217;\u00a0command-line tool Kubectl on Ubuntu 22.04 but are unsure how? This guide will show you how to install Kubectl on Ubuntu 22.04, which will enable you to interact with or execute commands on\u00a0Kubernetes clusters. By the end of this guide, you should have Kubectl installed on your system. What is Kubectl? [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/\" \/>\n<meta property=\"og:site_name\" content=\"GreenCloud Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-19T00:45:47+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_1-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-kubectl-on-ubuntu-22-04\\\/\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-kubectl-on-ubuntu-22-04\\\/\",\"name\":\"How to install Kubectl on Ubuntu 22.04 - GreenCloud Documentation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-kubectl-on-ubuntu-22-04\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-kubectl-on-ubuntu-22-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/Screenshot_1-1.png\",\"datePublished\":\"2024-02-20T07:28:43+00:00\",\"dateModified\":\"2026-01-19T00:45:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-kubectl-on-ubuntu-22-04\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-kubectl-on-ubuntu-22-04\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-kubectl-on-ubuntu-22-04\\\/#primaryimage\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/Screenshot_1-1.png\",\"contentUrl\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/Screenshot_1-1.png\",\"width\":905,\"height\":151},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-kubectl-on-ubuntu-22-04\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GreenCloud Documents\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/docs\\\/greencloud-documents\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Linux Operating Systems\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/linux-operating-systems\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to install Kubectl on Ubuntu 22.04\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/#website\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/\",\"name\":\"GreenCloud Documentation\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/green.cloud\\\/docs\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to install Kubectl on Ubuntu 22.04 - GreenCloud Documentation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/","og_locale":"en_US","og_type":"article","og_title":"How to install Kubectl on Ubuntu 22.04 - GreenCloud Documentation","og_description":"Do you want to install\u00a0Kubernetes&#8217;\u00a0command-line tool Kubectl on Ubuntu 22.04 but are unsure how? This guide will show you how to install Kubectl on Ubuntu 22.04, which will enable you to interact with or execute commands on\u00a0Kubernetes clusters. By the end of this guide, you should have Kubectl installed on your system. What is Kubectl? [&hellip;]","og_url":"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/","og_site_name":"GreenCloud Documentation","article_modified_time":"2026-01-19T00:45:47+00:00","og_image":[{"url":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_1-1.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/","url":"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/","name":"How to install Kubectl on Ubuntu 22.04 - GreenCloud Documentation","isPartOf":{"@id":"https:\/\/green.cloud\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/#primaryimage"},"image":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/#primaryimage"},"thumbnailUrl":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_1-1.png","datePublished":"2024-02-20T07:28:43+00:00","dateModified":"2026-01-19T00:45:47+00:00","breadcrumb":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/#primaryimage","url":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_1-1.png","contentUrl":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2024\/02\/Screenshot_1-1.png","width":905,"height":151},{"@type":"BreadcrumbList","@id":"https:\/\/green.cloud\/docs\/how-to-install-kubectl-on-ubuntu-22-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/green.cloud\/docs\/"},{"@type":"ListItem","position":2,"name":"GreenCloud Documents","item":"https:\/\/green.cloud\/docs\/docs\/greencloud-documents\/"},{"@type":"ListItem","position":3,"name":"Linux Operating Systems","item":"https:\/\/green.cloud\/docs\/linux-operating-systems\/"},{"@type":"ListItem","position":4,"name":"How to install Kubectl on Ubuntu 22.04"}]},{"@type":"WebSite","@id":"https:\/\/green.cloud\/docs\/#website","url":"https:\/\/green.cloud\/docs\/","name":"GreenCloud Documentation","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/green.cloud\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/25443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/comments?post=25443"}],"version-history":[{"count":14,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/25443\/revisions"}],"predecessor-version":[{"id":26653,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/25443\/revisions\/26653"}],"up":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/17817"}],"wp:attachment":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/media?parent=25443"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/doc_tag?post=25443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}