Browse Source

updated the metalLb installation to helm install and also updated the k8s_config_file_mode permissions

Signed-off-by: Khushboodholi <Khushboo.dholi@gmail.com>
Khushboodholi 3 years ago
parent
commit
2983d1c61f

+ 2 - 2
roles/k8s_start_manager/vars/main.yml

@@ -23,7 +23,7 @@ k8s_config_src: /etc/kubernetes/admin.conf
 
 k8s_config_dest: /root/.kube/config
 
-k8s_config_file_mode: 0644
+k8s_config_file_mode: 0600
 
 k8s_cert_path: /etc/kubernetes/pki/ca.crt
 
@@ -47,4 +47,4 @@ calico_yml_file_mode: 0644
 
 flannel_yml_file_path: /root/k8s/kube-flannel.yaml
 
-flannel_yml_file_mode: 0644
+flannel_yml_file_mode: 0644

+ 10 - 10
roles/k8s_start_services/files/metal-config.yaml

@@ -9,13 +9,13 @@ data:
     - name: default
       protocol: layer2
       addresses:
-      - 192.168.2.150/32
-      - 192.168.2.151/32
-      - 192.168.2.152/32
-      - 192.168.2.153/32
-      - 192.168.2.154/32
-      - 192.168.2.155/32
-      - 192.168.2.156/32
-      - 192.168.2.157/32
-      - 192.168.2.158/32
-      - 192.168.2.159/32
+      - 192.168.2.150/24
+      - 192.168.2.151/24
+      - 192.168.2.152/24
+      - 192.168.2.153/24
+      - 192.168.2.154/24
+      - 192.168.2.155/24
+      - 192.168.2.156/24
+      - 192.168.2.157/24
+      - 192.168.2.158/24
+      - 192.168.2.159/24

+ 5 - 15
roles/k8s_start_services/tasks/deploy_k8s_services.yml

@@ -34,11 +34,9 @@
   register: k8s_pods
   tags: init
 
-- name: Deploy MetalLB
-  command: "kubectl apply -f '{{ metallb_yaml_url }}'"
-  changed_when: true
-  when: "'metallb' not in k8s_pods.stdout"
-  tags: init
+- name: Get metallb repo
+  command: "helm repo add metallb https://metallb.github.io/metallb"
+ 
 
 - name: Create MetalLB Setup Config Files
   copy:
@@ -58,17 +56,9 @@
     mode: "{{ metallb_deployment_file_mode }}"
   tags: init
 
-- name: Deploy MetalLB
-  command: "kubectl apply -f '{{ metallb_deployment_file_dest }}'"
-  changed_when: true
-  when: "'metallb' not in k8s_pods.stdout"
-  tags: init
+- name: Deploy Metallb
+  command: "helm install metallb metallb/metallb  -f '{{ metallb_config_file_dest }}'/metal-config.yaml"
 
-- name: Create default setup for MetalLB
-  command: "kubectl apply -f '{{ metallb_config_file_dest }}'"
-  changed_when: true
-  when: "'metallb' not in k8s_pods.stdout"
-  tags: init
 
 - name: Start k8s dashboard
   command: "kubectl create -f '{{ k8s_dashboard_yaml_url }}'"