瀏覽代碼

Merge pull request #961 from Khushboodholi/issue-902

Issue 902: Updated the metallb installation thru helm
Sujit Jadhav 3 年之前
父節點
當前提交
e4a64512d2

+ 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

+ 7 - 14
roles/k8s_start_services/tasks/deploy_k8s_services.yml

@@ -34,11 +34,11 @@
   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"
+- name: Get metallb repo
+  command: "helm repo add metallb '{{ metallb_helm_url }}'"
+  changed_when: false
   tags: init
+ 
 
 - name: Create MetalLB Setup Config Files
   copy:
@@ -58,16 +58,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: Create default setup for MetalLB
-  command: "kubectl apply -f '{{ metallb_config_file_dest }}'"
-  changed_when: true
-  when: "'metallb' not in k8s_pods.stdout"
+- name: Deploy Metallb
+  command: "helm install metallb metallb/metallb  -f '{{ metallb_config_file_dest }}'"
+  changed_when: false
   tags: init
 
 - name: Start k8s dashboard

+ 2 - 0
roles/k8s_start_services/vars/main.yml

@@ -53,6 +53,8 @@ metallb_deployment_file_mode: 0655
 
 metallb_yaml_url: https://raw.githubusercontent.com/google/metallb/v0.8.1/manifests/metallb.yaml
 
+metallb_helm_url: https://metallb.github.io/metallb
+
 k8s_dashboard_admin_file_dest: /root/k8s/k8s_dashboard_admin.yaml
 
 k8s_dashboard_admin_file_mode: 0655