IT Days in Lodz

20.11.2019 - 21.11.2019

DevOps-Docker-K8S-Intro-PL-2.pdf
$script = <<-SHELL
echo test 
SHELL
Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/xenial64"
  config.disksize.size = "30GB"
  config.vm.provider "virtualbox" do |vb|
     vb.memory = "10000"
     vb.cpus =  "8"
  end
  config.vm.provision "shell", inline: $script
end
$script = <<-SHELL
echo installing DOCKER 
apt-get update
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install docker-ce docker-ce-cli -y
SHELL

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/xenial64"
  config.disksize.size = "30GB"
  config.vm.provider "virtualbox" do |vb|
     vb.memory = "4000"
     vb.cpus =  "4"
  end
  config.vm.provision "shell", inline: $script
end
$script = <<-SHELL
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
sudo update-alternatives --set arptables /usr/sbin/arptables-legacy
sudo update-alternatives --set ebtables /usr/sbin/ebtables-legacy

echo installing DOCKER 
apt-get update
apt-get install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install docker-ce docker-ce-cli -y

echo installing K*S 

sudo apt-get update && sudo apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl

systemctl daemon-reload
systemctl restart kubelet

kubeadm init
mkdir -p $HOME/.kube
mkdir /home/vagrant/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
cp -i /etc/kubernetes/admin.conf /home/vagrant/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config
chown vagrant:vagrant /home/vagrant/.kube/config
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
kubectl taint nodes --all node-role.kubernetes.io/master-
kubectl apply -f https://k8s.io/examples/application/deployment.yaml
SHELL

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/xenial64"
  config.disksize.size = "30GB"
  config.vm.provider "virtualbox" do |vb|
     vb.memory = "4000"
     vb.cpus =  "4"
  end
  config.vm.provision "shell", inline: $script
end