summaryrefslogtreecommitdiffstats
path: root/edge/sample/roles/clusterForm_master/tasks
diff options
context:
space:
mode:
authoradarsh1001 <adarshpalsingh1996@gmail.com>2018-07-22 02:11:47 +0530
committeradarsh1001 <adarshpalsingh1996@gmail.com>2018-07-22 02:20:49 +0530
commit667fa134daca1c7264d0abfabfb1ce443a82ccc4 (patch)
treeb710f9228d3ec0f6965329d9f40689b1636413a6 /edge/sample/roles/clusterForm_master/tasks
parent0254cb223d2eace1eaf295eacf4cea4fc4fd9844 (diff)
Add ansible scripts for raspberry pi based kubernetes edge cluster
JIRA: CLOVER-71 This issue falls under the "Edge Cloud-Native Cluster" intern project and is a part of both Clover and Edge cloud projects. The detailed description of the project and the instructions for using the scripts are documented in the README. Change-Id: I4fdb98f17ae0c53f918376ad6fb90be8ff0b0a71 Signed-off-by: adarsh1001 <adarshpalsingh1996@gmail.com>
Diffstat (limited to 'edge/sample/roles/clusterForm_master/tasks')
-rw-r--r--edge/sample/roles/clusterForm_master/tasks/main.yml72
1 files changed, 72 insertions, 0 deletions
diff --git a/edge/sample/roles/clusterForm_master/tasks/main.yml b/edge/sample/roles/clusterForm_master/tasks/main.yml
new file mode 100644
index 0000000..9137d7f
--- /dev/null
+++ b/edge/sample/roles/clusterForm_master/tasks/main.yml
@@ -0,0 +1,72 @@
+# Copyright (c) Authors of Clover
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+
+- name: Resetting kubeadm on master
+ shell: kubeadm reset
+
+- name: Removing KUBELET_NETWORK_ARGS flag in the kubadm config file
+ shell: sed -i '/KUBELET_NETWORK_ARGS=/d' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf
+ args:
+ warn: false
+
+- name: Removing redundant config files (1/3)
+ file:
+ path: /home/pi/.kube
+ state: absent
+
+- name: Removing redundant config files (2/3)
+ file:
+ path: /home/pi/join.sh
+ state: absent
+
+- name: Removing redundant config files (3/3)
+ file:
+ path: /home/pi/kubelog.txt
+ state: absent
+
+- name: Initializing kubeadm
+ shell: kubeadm init --token-ttl=0 --pod-network-cidr 10.244.0.0/16 --apiserver-advertise-address={{ ansible_default_ipv4.address }} > kubelog.txt
+
+- name: Scraping the join token
+ shell: cat kubelog.txt | grep 'kubeadm join' > join.sh && sed "s/^[ \t]*//" -i join.sh
+ args:
+ warn: false
+ become: false
+
+- name: Fetching the joining script
+ fetch:
+ src: /home/pi/join.sh
+ dest: ./
+ flat: yes
+ become: false
+
+- name: Making a .kube directory in home
+ file:
+ path: /home/pi/.kube
+ state: directory
+ become: false
+
+- name: Copying admin config file to .kube directory
+ copy:
+ src: /etc/kubernetes/admin.conf
+ dest: /home/pi/.kube/config
+ remote_src: yes
+
+- name: Changing user and group ownership of the config file
+ shell: chown $(id -u):$(id -g) /home/pi/.kube/config
+ args:
+ warn: false
+
+- name: Installing Flannel
+ shell: curl -sSL https://rawgit.com/coreos/flannel/v0.10.0/Documentation/kube-flannel.yml | sed "s/amd64/arm/g" | kubectl create -f -
+ args:
+ warn: false
+ become: false
+
+- name: Pause a minute for system containers to spin up
+ pause:
+ minutes: 1