Containers (Docker, Kubernetes,Prometheus)

(This is a work in progress)

If you have not played with containers, they are an interesting subject. In a simple/general concept they are Virtual Machines(VM’s) except smaller and simpler.

To begin vagrant is a good tool to create a VM to run docker in and set up and practice on your own machine with out messing anything up on your computer

Currently my daily driver is Ubuntu but i switch to a different distro every couple of months so commands might change a little.

sudo apt install -y virtualbox vagrant

sudo adduser <username> libvirtd

If you get an error about another hypervisor being used you have to blacklist the module use ls mod | grep kvm to see all your hypervisors

ls mod | grep kvm

mine was kvm-amd

sudo echo 'blacklist kvm-amd' >> /etc/modprobe.d/blacklist.conf

Might need some other dependencies just read any errors you get and install them a couple i ran into was

systemctl status libvirtd

sudo apt install libvirt-daemon

sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager

sudo apt install linux-headers-generic

sudo apt install virtualbox-dkms

Vagrant is very simple to use. It uses folders as a way to separate the VM’s so if you want another VM to work with make another folder in the vagrant directory can be whatever you want to call it and cd into it and just run vagrant init <box_name>. Visit vagrants boxes website https://app.vagrantup.com/boxes/search

mkdir ~/vagrant

cd ~/vagrant

mkdir centos

cd centos

vagrant init centos/7

There will now be a file in that folder called Vagrant File, edit this file to make a virtual network that allows you to connect to it if you want to make a httpd container with a website and use your web browser to access it

nano Vagrantfile

vagrantfile

Save it

To start up the VM:

vagrant up

Then to ssh to it:

vagrant ssh

Now you are in your VM:

sudo yum update -y

To exit the VM just type exit