Skip to content

Kubernetes on LXD

Syed Sayem edited this page Apr 11, 2019 · 10 revisions

In progress....

The best way to create a Kubernetes cluster is to use Vagrant with LXC

 

Table of contents

 

top

 

Prerequisite

  • Ubuntu 18.04+
  • LXC 2.1+
  • Ansible 2.6+
  • Vagrant 2.2.4+
    • Vagrant-lxc plugin
  • Kubernetes CLI

 

top

 

Installation

If you’re in a hurry, you can just copy and paste the following commands into your terminal:

sudo apt-get -y purge vagrant && \
wget https://releases.hashicorp.com/vagrant/2.2.4/vagrant_2.2.4_x86_64.deb && \
sudo dpkg -i vagrant*.deb && \
sudo apt-get -y install build-essential git ruby lxc lxc-templates cgroup-lite redir && \
vagrant plugin install vagrant-lxc && \
vagrant lxc sudoers

For a step-by-step explanation, read on.

 

Install Vagrant

For Ubuntu 18.04 Bionic or newer, you can just install from apt:

sudo apt install vagrant

For Ubuntu 16.04 Xenial and 14.04 Trusty, you’ll need a more recent version of Vagrant than what’s available in the official Ubuntu repositories.

First uninstall any vagrant package you may have installed from the Ubuntu repository:

sudo apt-get purge vagrant

Now download and install the .deb package for Vagrant. E.g.:

wget https://releases.hashicorp.com/vagrant/2.2.4/vagrant_2.2.4_x86_64.deb
sudo dpkg -i vagrant*.deb

Install remaining dependencies

Now install git and lxc-related packages:

sudo apt-get install build-essential git ruby lxc lxc-templates cgroup-lite redir

Install the vagrant lxc plugin

vagrant plugin install vagrant-lxc

Configure sudo to be passwordless

Finally, configure sudo to be passwordless when using Vagrant LXC:

vagrant lxc sudoers