DEV Community

Mohamed M El-Kalioby
Mohamed M El-Kalioby

Posted on

Django on K8s (Part I: Installing Docker & minikube)

Introduction

Docker is the de-facto standard for containers, Minikube is a developers playground to test and use Kubernetes without the hassle of installing it, and it can be deployed with Vagrant, or libvirt but we will use docker in this series.

Installing Docker

Installing Docker from the docker repo (based on docker documentation)

  • Remove old version

sudo apt-get remove docker docker-engine docker.io containerd runc

  • Download the required tools

sudo apt-get install ca-certificates curl gnupg lsb-release

  • Add Docker repo key

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

  • Add Docker repo to apt

echo "deb [arch=$(dpkg --print-architecture) 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 > /dev/null

  • Install Docker
    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io

  • Test Installation

sudo docker run hello-world

The steps are in install-docker.sh on the github

You shall end up by the following
Docker Installed

Note: Add your user to docker group and re-login to ubuntu.

sudo adduser $USER docker

Install minikube

Minikube configures all Kubernetes layers for the developer to play around & it has alot of options

  • Get the minikube binary using the link below for Ubuntu on amd64 or get the correct binary from the following url minikube for other platforms

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

  • Alias kubectl command
    alias kubectl="minikube kubectl --"

  • Create your minikube cluster

minikube start

Note: you can the minikube cluster IP range using --service-cluster-ip-range if your company is using 10.0.0.0/8 range as minikube network defaults to 10.96.0.0/12.

You shall end with something like the image below.

minikube installed

  • Test your minikube

Run kubectl get po which shall show that no resources available as shown below

minikube working

This concludes Part I of the series and next is creating a docker image for the django application.

Oldest comments (1)

Collapse
 
joaorafaelm profile image
João

if anyone is on a mac m1 and having trouble starting minikube, you need to docker as the default driver before starting minikube: minikube config set driver docker