Skip to content

Instantly share code, notes, and snippets.

@luigidifraia
Last active July 3, 2020 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luigidifraia/4286871762d161f4daa89b83d23a7727 to your computer and use it in GitHub Desktop.
Save luigidifraia/4286871762d161f4daa89b83d23a7727 to your computer and use it in GitHub Desktop.
Some useful snippets to install Docker and microk8s on Ubuntu 18.04 LTS (Bionic Beaver)

Base upgrade of Ubuntu 18

sudo apt-get update
sudo apt-get upgrade -y

Docker CE installation

sudo apt-get install -y \
	apt-transport-https \
	ca-certificates \
	curl \
	gnupg-agent \
	software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository \
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) \
  stable"

sudo apt-get update

sudo apt-get install -y docker-ce

sudo usermod -a -G docker $(whoami)

Allow insecure Docker registries

sudo tee /etc/docker/daemon.json <<EOF
{
  "insecure-registries" : ["localhost:32000"]
}
EOF

sudo kill -SIGHUP $(pidof dockerd)

Warning

Disable localhost entries for IPv6 addresses in '/etc/localhost', otherwise Docker image pulling from the local registry using localhost will not work.

MicroK8s 1.18 installation

sudo apt-get install -y snapd

sudo snap install microk8s --classic --channel=1.18/stable

Now log out of/back in the shell.

Allow name resolution from within pods

sudo iptables -P FORWARD ACCEPT

Persist the above rule

sudo apt-get install -y iptables-persistent
sudo iptables-save | sudo tee /etc/iptables/rules.v4

Set user permissions

sudo usermod -a -G microk8s $(whoami)
sudo chown -f -R $(whoami) ~/.kube

Enable standard addons

microk8s.enable dns registry ingress

Inspect your setup

microk8s.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment