<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Nishant Rajput</title>
    <description>The latest articles on Forem by Nishant Rajput (@nishant_rajput).</description>
    <link>https://forem.com/nishant_rajput</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F471625%2F6ffed4e6-da9a-4b48-ba31-826feab94037.jpeg</url>
      <title>Forem: Nishant Rajput</title>
      <link>https://forem.com/nishant_rajput</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nishant_rajput"/>
    <language>en</language>
    <item>
      <title>Installing Docker and Kubernetes on Ubuntu</title>
      <dc:creator>Nishant Rajput</dc:creator>
      <pubDate>Sat, 17 Jul 2021 16:33:25 +0000</pubDate>
      <link>https://forem.com/nishant_rajput/installing-docker-and-kubernetes-on-ubuntu-32hj</link>
      <guid>https://forem.com/nishant_rajput/installing-docker-and-kubernetes-on-ubuntu-32hj</guid>
      <description>&lt;p&gt;Docker and Kubernetes are the heroes of the DevOps world. &lt;br&gt;
Docker is a containerization platform and Kubernetes is a container orchestrator for platforms like Docker.&lt;/p&gt;

&lt;p&gt;This article will discuss how we can set up Docker and Kubernetes on our Ubuntu machine.&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting Up Docker
&lt;/h2&gt;

&lt;p&gt;We will be setting up Docker by adding its repository to our package index and then installing the Docker Debian packages via our &lt;code&gt;apt&lt;/code&gt; package manager.&lt;/p&gt;

&lt;p&gt;Let's begin.&lt;/p&gt;
&lt;h4&gt;
  
  
  Step-1: Refreshing package index and installing packages to use repository over https
&lt;/h4&gt;

&lt;p&gt;First, we will refresh our package index, and install some packages which will help us add PGP keys and setting up therepository right through &lt;code&gt;https&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt-get update
$ sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-2: Adding Docker's official GPG key
&lt;/h4&gt;

&lt;p&gt;Run the below command, and it will automatically add Docker PGP keys to our system&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-3: Adding docker repository to &lt;code&gt;apt&lt;/code&gt; package index
&lt;/h4&gt;

&lt;p&gt;Now that we are done adding keys, it's time to add the repository URL which will help us install and timely update Docker on our system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-4: Refreshing package index and Installing Docker &lt;code&gt;apt&lt;/code&gt; packages
&lt;/h4&gt;

&lt;p&gt;Now finally, it's time to install Docker. But first, we will need to refresh our package index as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt-get update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-5: Testing Docker
&lt;/h4&gt;

&lt;p&gt;Now that we have installed Docker, let us test it and give it a try.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo docker run hello-world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After you have run the above command if everything works fine you see output like below the image on your screen.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iqT8glN7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fme6rhs8yn3ypwx282az.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iqT8glN7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fme6rhs8yn3ypwx282az.png" alt="Screenshot from 2021-07-17 13-10-53"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting Up Kubernetes
&lt;/h2&gt;

&lt;p&gt;We will go through the process to install Kubernetes through the &lt;code&gt;apt&lt;/code&gt; package manager and &lt;code&gt;snap&lt;/code&gt; both. You can choose which suits you better&lt;/p&gt;
&lt;h3&gt;
  
  
  Installing via &lt;code&gt;apt&lt;/code&gt; package manager
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Step-1: Refreshing package index and installing packages to use repository over https
&lt;/h4&gt;

&lt;p&gt;First, we will refresh our package index, and install some packages which will help us add PGP keys and setting up the repository right through &lt;code&gt;https&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt-get update
$ sudo apt-get install -y apt-transport-https ca-certificates curl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-2: Adding Kubernetes PGP key
&lt;/h4&gt;

&lt;p&gt;Run the below command, and it will automatically add Kubernetes PGP keys to our system&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-3: Adding Kubernetes repository to package index
&lt;/h4&gt;

&lt;p&gt;Now that we are done adding keys, it's time to add repository URL which will help us install and timely update Kubernetes (&lt;code&gt;kubectl&lt;/code&gt;) on our system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step-4: Refreshing package index and installing Kubectl
&lt;/h4&gt;

&lt;p&gt;Now finally, its time to install Kubernetes(&lt;code&gt;kubectl&lt;/code&gt;). But first, we will need to refresh our package index as well.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo apt-get update
$ sudo apt-get install -y kubectl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Installing Kubectl via &lt;code&gt;snap&lt;/code&gt; package manager
&lt;/h3&gt;

&lt;p&gt;Installing &lt;code&gt;kubectl&lt;/code&gt; via &lt;code&gt;snap&lt;/code&gt; is pretty easy and a single command work. You can also pick this alternative to set up Kubernetes. Though I will recommend installing via &lt;code&gt;apt&lt;/code&gt; package manager as it is easily updatable.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ snap install kubectl --classic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>awsugjaipur</category>
      <category>docker</category>
      <category>kubernetes</category>
    </item>
  </channel>
</rss>
