Django on K8s (Part I: Installing Docker & minikube)
Mohamed M El-Kalioby
Posted on January 7, 2022
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
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.
- Test your minikube
Run kubectl get po
which shall show that no resources available as shown below
This concludes Part I of the series and next is creating a docker image for the django application.
Posted on January 7, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.