Today's Question:  What does your personal desk look like?        GIVE A SHOUT

Install Kubernetes with minikube and docker on Ubuntu

  sonic0002        2021-06-01 05:37:40       1,812        0    

When someone just wants to play around Kubernetes on its local environment without accessing to Cloud provider resources, one can set Kubernetes up on local environment with minikube with single node mode.

This post will provide a simple guideline on how to set up KUbernetes with minikube and docker on Ubuntu.

Before all the steps can be started, you may need to first set up kubectl which is a command line tool to operate on Kubernetes resources.

Post that, can ensure that docker is installed on Ubuntu, in case it's not installed, can follow below steps.

  1. Update local software repository database
    sudo apt-get update​
  2. (Optional) Uninstall old docker in case it's existing
    sudo apt-get remove docker docker-engine docker.io​
  3. Install docker
    sudo apt install docker.io​
  4. Once installation is done, can set it up to be ran at system start
    sudo systemctl start docker
    sudo systemctl enable docker​
  5. Check that whether the daemon service is up and docker is available
    k8s@k8s-VirtualBox:~$ docker version
    Client:
     Version:           20.10.2
     API version:       1.41
     Go version:        go1.13.8
     Git commit:        20.10.2-0ubuntu1~20.04.2
     Built:             Tue Mar 30 21:24:57 2021
     OS/Arch:           linux/amd64
     Context:           default
     Experimental:      true
    
    Server:
     Engine:
      Version:          20.10.2
      API version:      1.41 (minimum version 1.12)
      Go version:       go1.13.8
      Git commit:       20.10.2-0ubuntu1~20.04.2
      Built:            Mon Mar 29 19:10:09 2021
      OS/Arch:          linux/amd64
      Experimental:     false
     containerd:
      Version:          1.3.3-0ubuntu2.3
      GitCommit:        
     runc:
      Version:          spec: 1.0.2-dev
      GitCommit:        
     docker-init:
      Version:          0.19.0
      GitCommit:        
    ​
    You should see both client and server information. In case no server information is found and it says permission error, you need to add the current user into user group docker. By default, only users in docker group can access this information, otherwise sudo command is needed.
    To add the current user into the docker user group, can run below command
    sudo usermod -aG docker $USER​
    Post that, log out as current user and login back(If you are in Virtual Machine, you may need to restart the system)

Once docker is installed, one can proceed to install minikube. Below are the steps to be followed.

  1. Get the command to install minikube from https://minikube.sigs.k8s.io/docs/start/
    curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
    sudo install minikube-linux-amd64 /usr/local/bin/minikube​
  2. The command is pretty straightforward, it downloads the minikube binary and install it. Run below command to verify it's installed successfully.
    k8s@k8s-VirtualBox:~$ minikube version
    minikube version: v1.20.0
    commit: c61663e942ec43b20e8e70839dcca52e44cd85ae
    ​
  3. Next can run minikube start to start the cluster
    minikube start --driver=docker​
    This tells minikube to use docker as the driver instead of virtualbox(default one).
  4. Once it's started, can run minikube status to check its status.
    k8s@k8s-VirtualBox:~$ minikube status
    minikube
    type: Control Plane
    host: Running
    kubelet: Running
    apiserver: Running
    kubeconfig: Configured​
  5. Next, can just run normal kubectl commands to access the Kubernetes cluster
    k8s@k8s-VirtualBox:~$ kubectl get pods
    NAME                              READY   STATUS    RESTARTS   AGE
    hello-minikube-6ddfcc9757-9vl9s   1/1     Running   1          20h
    =​

UBUNTU  DOCKER  KUBERNETES  MINIKUBE 

Share on Facebook  Share on Twitter  Share on Weibo  Share on Reddit 

  RELATED


  0 COMMENT


No comment for this article.