Provision master

This commit is contained in:
Khue Doan 2020-07-26 01:37:30 +07:00
parent ad8274a4b1
commit 4db74a689f

View File

@ -50,6 +50,29 @@ resource "lxd_container" "kubernetes_controllers" {
image = "images:ubuntu/18.04"
ephemeral = false
profiles = [ lxd_profile.kubernetes.name ]
provisioner "local-exec" {
command = <<EXEC
lxc exec ${self.name} -- bash -xe -c '
sudo apt-get install 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 docker-ce docker-ce-cli containerd.io
sudo systemctl enable --now docker
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
sudo systemctl daemon-reload
sudo systemctl enable --now kubelet
'
EXEC
}
}
resource "lxd_container" "kubernetes_workers" {