{"id":16492,"date":"2022-04-06T07:47:11","date_gmt":"2022-04-06T07:47:11","guid":{"rendered":"https:\/\/linuxways.net\/?p=16492"},"modified":"2022-04-06T07:47:11","modified_gmt":"2022-04-06T07:47:11","slug":"how-to-deploy-single-node-kubernetes-with-microk8s-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-deploy-single-node-kubernetes-with-microk8s-on-ubuntu-20-04\/","title":{"rendered":"How to Deploy Single Node Kubernetes with Microk8s on Ubuntu 20.04"},"content":{"rendered":"<h2>What is Kubernetes?<\/h2>\n<p>Kubernetes is a free, open source, extensible, and portable platform used to manage containerized services and workload in different types of physical, cloud, and virtual environments. It assists in automation and declarative configuration. It has a vast and speedily expanding ecosystem. Kubernetes tools, support, and services are widely available.<\/p>\n<h2>Features of Kubernetes:<\/h2>\n<p>Following are the features that Kubernetes supports:<\/p>\n<p>Self-healing capabilities<\/p>\n<p>Automated scheduling<\/p>\n<p>Load Balancing<\/p>\n<p>Horizontal Scaling<\/p>\n<p>Automated Rollouts<\/p>\n<p>Environment consistency for development, testing, and production<\/p>\n<p>Auto-scalable infrastructure<\/p>\n<p>Application Centric Management<\/p>\n<p>High Resource utilization<\/p>\n<p>Can create predictable infrastructure<\/p>\n<p>Enterprise ready features and so much more.<\/p>\n<p>In this article, we will look at how to install single node Kubernetes with the help of a few easy to follow commands. To demonstrate the deployment process, we have used Ubuntu 20.04 as the operating system. Ubuntu is a highly efficient and widely used distribution of Linux. Due to its focus on user friendliness, many people use it as a daily driver. It is also the most used distribution in the tech community.<\/p>\n<p>We will install Kubernetes using the command line interface (also known as Terminal).<\/p>\n<p>Without any further ado, let\u2019s get started.<\/p>\n<h2>Installation Guide:<\/h2>\n<p>Following are the steps involved in the deployment process of Kubernetes on Ubuntu:<\/p>\n<h3>Step 1: Install MicroK8s<\/h3>\n<p>We first need to install MicroK8s on our Ubuntu system. It is a minimal, lightweight, small, and fully conformant distribution of Kubernetes. We are using snapd package manager to install microk8s.<\/p>\n<p>If you don\u2019t have snapd package manager, you can install it from here:<\/p>\n<pre><a href=\"https:\/\/snapcraft.io\/docs\/installing-snapd?_ga=2.126145930.647748854.1648705733-158347252.1648705733\">https:\/\/snapcraft.io\/docs\/installing-snapd?_ga=2.126145930.647748854.1648705733-158347252.1648705733<\/a><\/pre>\n<p>To install microk8s, we will run the following command:<\/p>\n<pre>sudo snap install microk8s --classic<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"332\" height=\"28\" class=\"wp-image-16493\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-17.png 332w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-17-300x25.png 300w\" sizes=\"auto, (max-width: 332px) 100vw, 332px\" \/><\/p>\n<h3>Step 2: Grant admin privileges to your user<\/h3>\n<p>Admin privilege is required for seamless usage of commands. For that a group is created, which can be joined using the following commands:<\/p>\n<pre>sudo usermod -a -G microk8s $USER<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"313\" height=\"31\" class=\"wp-image-16494\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-18.png 313w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-18-300x30.png 300w\" sizes=\"auto, (max-width: 313px) 100vw, 313px\" \/><\/p>\n<pre>sudo chown -f -R $USER ~\/.kube<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"279\" height=\"29\" class=\"wp-image-16495\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-19.png\" \/><\/p>\n<p>To update the group, you will have to re-enter the session by executing the command mentioned below:<\/p>\n<pre>su - $USER<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"110\" height=\"26\" class=\"wp-image-16496\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-20.png\" \/><\/p>\n<h3>Step 3: Check Kubernetes status<\/h3>\n<p>To check the status of Kubernetes while it is being started, run the following command:<\/p>\n<pre>microk8s status --wait-ready<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"257\" height=\"32\" class=\"wp-image-16497\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-21.png\" \/><\/p>\n<h3>Step 4: Enable the services you want<\/h3>\n<p>In this step, we will enable the services we want. To see all the available services and optional features, run this command:<\/p>\n<pre>microk8s enable \u2013help<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"197\" height=\"34\" class=\"wp-image-16498\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-22.png\" \/><\/p>\n<p>To enable a particular service, issue the following command:<\/p>\n<pre>microk8s enable dashboard dns ingress<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"339\" height=\"29\" class=\"wp-image-16499\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-23.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-23.png 339w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-23-300x26.png 300w\" sizes=\"auto, (max-width: 339px) 100vw, 339px\" \/><\/p>\n<p>To disable a service, execute the following command:<\/p>\n<pre>Microk8s disable &lt;name&gt;<\/pre>\n<h3>Step 5: Begin using Kubernetes<\/h3>\n<p>Now that we are done with the essential configurations, let\u2019s start using Kubernetes.<\/p>\n<p>You can make kubectl the default Kubernetes management tool on your terminal if you use microk8s. To do that, type<\/p>\n<p>Alias mkctl=\u201dmicrok8s kubectl\u201d. You can also manage other Kubernetes clusters with kubectl by pointing to the respective kubeconfig file through the \u201c\u2014kubeconfig\u201d argument.<\/p>\n<pre>microk8s kubectl get all --all-namespaces<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"377\" height=\"31\" class=\"wp-image-16500\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-24.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-24.png 377w, https:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-24-300x25.png 300w\" sizes=\"auto, (max-width: 377px) 100vw, 377px\" \/><\/p>\n<h3>Step 6: Access the Kubernetes dashboard<\/h3>\n<p>To access the Kubernetes dashboard, you can use the following command:<\/p>\n<pre>microk8s dashboard-proxy<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"224\" height=\"28\" class=\"wp-image-16501\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-25.png\" \/><\/p>\n<h3>Step 7: Start Microk8s<\/h3>\n<p>You can start a service by running the following command:<\/p>\n<pre>microk8s start<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"132\" height=\"31\" class=\"wp-image-16502\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-26.png\" \/><\/p>\n<h3>Step 8: Stop Microk8s<\/h3>\n<p>To stop a service, run the following command:<\/p>\n<pre>microk8s stop<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"127\" height=\"28\" class=\"wp-image-16503\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2022\/04\/word-image-27.png\" \/><\/p>\n<p>In today\u2019s guide, we saw in detail how to install Single Node Kubernetes with microk8s on Ubuntu 20.04. We also explored different commands that are used to configure the Kubernetes instance.<\/p>\n<p>We hope you had a great time exploring the guide.<\/p>\n<p>To learn how to use \u2018kubectl get\u2019 with the help of a few examples, do give this page a try:<\/p>\n<p><a href=\"https:\/\/linuxways.net\/de\/centos\/kubectl-get-command-explained-with-examples\/\">https:\/\/linuxways.net\/centos\/kubectl-get-command-explained-with-examples\/<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>What is Kubernetes? Kubernetes is a free, open source, extensible, and portable platform used to manage containerized services and workload in different types of physical, cloud, and virtual&hellip;<\/p>","protected":false},"author":1,"featured_media":16567,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[965,966,100],"class_list":["post-16492","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-kubernetes","tag-microk8s","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/16492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=16492"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/16492\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/16567"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=16492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=16492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=16492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}