Installing Docker with Kubernetes and Helm

·

3 min read

Installing Docker with Kubernetes and Helm

Installing Docker

  • Step 1: Remove old versions of Docker if they've previously been installed:
    sudo apt-get remove docker docker-engine docker.io containerd runc
    
  • Step 2: Install packages that allow APT to use HTTPS:

    $ sudo apt-get update
    $ sudo apt-get install -y \
      apt-transport-https \
      ca-certificates \
      curl \
      gnupg-agent \
      software-properties-common
    
  • Step 3: Add Docker's GPG key:

    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
  • Step 4: Add the Docker repository:

    sudo add-apt-repository \
         "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
         $(lsb_release -cs) \
         stable"
    
  • Step 5: Install the Docker engine:
    $ sudo apt-get update
    $ sudo apt-get install -y docker-ce docker-ce-cli containerd.io
    
  • Step 6: Add your login to the Docker group:

    sudo usermod -aG docker $USER
    
  • Step 7: Logout of your SSH session and log back in for the changes to take effect.

  • Step 8: Verify the engine is installed correctly:

    docker run hello-world
    

Install Docker Compose

Docker Compose is a tool for configuring an app's services with a YAML file to define and run multi-container Docker applications.

  • Step 1: Download a copy of Docker Compose:
    sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    
  • Step 2: Make the app executable:

    sudo chmod +x /usr/local/bin/docker-compose
    
  • Step 3: Test the installation:

    docker-compose --version
    

Install kubectl

The Kubernetes command-line tool allows you to deploy and manage Kubernetes clusters.

  • Step 1: Download kubectl:

    sudo curl -L "https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl" -o /usr/local/bin/kubectl
    
  • Step 2: Make the app executable:

    sudo chmod +x /usr/local/bin/kubectl
    
  • Step 3: Test the installation:

    kubectl version --short --client
    

Install minikube

  • Step 1:

    curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64;
    sudo install minikube-linux-amd64 /usr/local/bin/minikube;
    
  • Step 2:

    sudo usermod -aG docker $USER && newgrp docker
    
  • Step 3: If you get any error regarding drivers just got to this link

  • Step 4: check installation by running

    minikube version
    

Install KinD

Kubernetes-in-Docker (KinD) is a tool for running local Kubernetes clusters using Docker container "nodes".

  • Step 1: Download KinD:

    sudo curl -L "https://kind.sigs.k8s.io/dl/v0.8.1/kind-$(uname)-amd64" -o /usr/local/bin/kind
    
  • Step 2: Make the app executable:

    sudo chmod +x /usr/local/bin/kind
    
  • Step 3: Test the installation:

    kind get clusters
    

Installing helm v3:

  • Step 1: Download the specific version from here

  • Step 2: Open your terminal and go to the path where you have downloaded the tar.gz file

  • Step 3: Unpack it using

    tar -zxvf <file_name>.tar.gz
    
  • Step 4: Move helm unpacked file to its desired destination using

    mv linux-amd64/helm /usr/local/bin/helm
    

Uninstalling Kubernetes

  • Just run these few simple commands in your terminal:
    kubeadm reset
    sudo apt-get purge kubeadm kubectl kubelet kubernetes-cni kube*   
    sudo apt-get autoremove  
    sudo rm -rf ~/.kube