From 8341079aa4ebf6a99f67923401f51857d9539183 Mon Sep 17 00:00:00 2001 From: ashgit301 Date: Wed, 15 Sep 2021 13:59:08 +0530 Subject: [PATCH] Added storage supoort to the template Signed-off-by: ashgit301 Change-Id: Ibcf6c944202b20e6a72bc7732c6de255ecfbc0c5 --- src/foundation/microk8s/main.tf | 6 +++++- src/foundation/microk8s/token | 3 --- src/foundation/microk8s/worker_user_data.tmpl | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 src/foundation/microk8s/token diff --git a/src/foundation/microk8s/main.tf b/src/foundation/microk8s/main.tf index fb59a14..db3453c 100644 --- a/src/foundation/microk8s/main.tf +++ b/src/foundation/microk8s/main.tf @@ -20,6 +20,7 @@ resource "aws_instance" "master" { snap install microk8s --classic --channel=1.20/stable >> microk8s_install.log microk8s status --wait-ready microk8s enable dns >> microk8s_install.log + microk8s enable storage >> microk8s_install.log microk8s add-node > microk8s.join_token microk8s config > configFile-master EOF @@ -32,7 +33,7 @@ resource "aws_instance" "master" { "sudo sed -i 's/#MOREIPS/IP.7 = ${self.public_ip}\\n#MOREIPS/g' /var/snap/microk8s/current/certs/csr.conf.template", "sudo sleep 1m", "sudo microk8s stop", - "sudo microk8s start" + "sudo microk8s start", ] } @@ -47,6 +48,7 @@ resource "aws_instance" "master" { provisioner "local-exec" { command = <> ~/.ssh/known_hosts scp -i terraform.pem ubuntu@${self.public_dns}:/microk8s.join_token . tail -n1 microk8s.join_token >> token @@ -122,6 +124,7 @@ resource "aws_instance" "worker" { ] } + resource "null_resource" "cluster" { provisioner "remote-exec" { inline = ["sudo microk8s kubectl get no >> kubectl.info"] @@ -161,3 +164,4 @@ output "public_ip" { output "private_ip" { value = aws_instance.master.private_ip } + diff --git a/src/foundation/microk8s/token b/src/foundation/microk8s/token deleted file mode 100644 index b874b22..0000000 --- a/src/foundation/microk8s/token +++ /dev/null @@ -1,3 +0,0 @@ - microk8s join 172.31.1.7:25000/f9248352b1c01fd71b52c29880a177b5 - microk8s join 172.31.10.73:25000/23c77c9fff9e96b8cb5599aa6ac38eac - microk8s join 172.31.3.101:25000/34d8296750d285c7deba6b62e8d12e44 diff --git a/src/foundation/microk8s/worker_user_data.tmpl b/src/foundation/microk8s/worker_user_data.tmpl index 619ffb4..f921e46 100644 --- a/src/foundation/microk8s/worker_user_data.tmpl +++ b/src/foundation/microk8s/worker_user_data.tmpl @@ -2,7 +2,7 @@ sudo apt update -y >> microk8s_install.log sudo apt install snapd -y >> microk8s_install.log -sudo snap install microk8s --classic --channel=1.20/stable >> microk8s_install.log +snap install microk8s --classic --channel=1.20/stable >> microk8s_install.log sudo microk8s enable dns >> microk8s_install.log sudo ${token} >> microk8s_install.log microk8s config > configFile-worker -- 2.16.6