From f8586a1fb047f9196de35d0fa41b9d41f41fd40e Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Wed, 2 May 2018 00:42:53 -0400 Subject: [PATCH 1/5] Resolves #7 Added custom repo for GlusterFS for our RPI's. Also added a fix for existing GlusterFS repos. --- README.md | 7 +++++++ inventory/group_vars/rpi_k8s/glusterfs.yml | 7 +++++++ playbooks/fix_glusterfs_repo.yml | 15 +++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 playbooks/fix_glusterfs_repo.yml diff --git a/README.md b/README.md index ae613c8..e4b41bc 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ - [Heapster](#heapster) - [InfluxDB/Grafana](#influxdbgrafana) - [Resetting The Kubernetes Cluster](#resetting-the-kubernetes-cluster) + - [Fixing Broken GlusterFS Repo](#fixing-broken-glusterfs-repo) - [License](#license) - [Author Information](#author-information) @@ -872,6 +873,12 @@ run the following `Ansible` playbook which will take care of that for you. ansible-playbook -i inventory/ playbooks/reset_cluster.yml ``` +## Fixing Broken GlusterFS Repo +If you experience the following [issue](https://github.com/mrlesmithjr/ansible-rpi-k8s-cluster/issues/7) you can +run the playbook [fix_glusterfs_repo.yml](playbooks/fix_glusterfs_repo.yml) which +will remove the broken `3.10` repo. Once that is done you should be good to go +and be able to run [deploy.yml](playbooks/deploy.yml) once again. + ## License MIT diff --git a/inventory/group_vars/rpi_k8s/glusterfs.yml b/inventory/group_vars/rpi_k8s/glusterfs.yml index ac7bcb1..a19ebf4 100644 --- a/inventory/group_vars/rpi_k8s/glusterfs.yml +++ b/inventory/group_vars/rpi_k8s/glusterfs.yml @@ -13,4 +13,11 @@ glusterfs_create_bricks: owner: root group: root +# defines Debian repo for GlusterFS +glusterfs_debian_repo_info: + key_url: "https://download.gluster.org/pub/gluster/glusterfs/{{ glusterfs_version }}/rsa.pub" + repo: "deb [arch=arm64] http://download.gluster.org/pub/gluster/glusterfs/{{ glusterfs_version }}/LATEST/Debian/{{ ansible_distribution_release|lower }}/arm64/apt {{ ansible_distribution_release|lower }} main" + +glusterfs_version: 3.13 + glusterfs_volume_force_create: true diff --git a/playbooks/fix_glusterfs_repo.yml b/playbooks/fix_glusterfs_repo.yml new file mode 100644 index 0000000..5d640ab --- /dev/null +++ b/playbooks/fix_glusterfs_repo.yml @@ -0,0 +1,15 @@ +--- +- hosts: rpi_k8s + vars: + glusterfs_versions_to_remove: + - "3.8" + - "3.9" + - "3.10" + tasks: + - name: debian | removing glusterfs apt repo + apt_repository: + repo: "deb http://download.gluster.org/pub/gluster/glusterfs/{{ item }}/LATEST/Debian/stretch/apt stretch main" + state: absent + become: true + with_items: "{{ glusterfs_versions_to_remove }}" + when: ansible_distribution == "Debian" From 3929787484703f77f16f1d3ec4f5cc2a5f213b36 Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Wed, 2 May 2018 09:38:43 -0400 Subject: [PATCH 2/5] Updated with proper location of GlusterFS gotchas --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e4b41bc..be09b59 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ - [Gotchas](#gotchas) - [sshpass error](#sshpass-error) - [SSH Key Missing](#ssh-key-missing) + - [Fixing Broken GlusterFS Repo](#fixing-broken-glusterfs-repo) - [Managing WI-FI On First Node](#managing-wi-fi-on-first-node) - [Routing](#routing) - [Adding Static Route On macOS](#adding-static-route-on-macos) @@ -52,7 +53,6 @@ - [Heapster](#heapster) - [InfluxDB/Grafana](#influxdbgrafana) - [Resetting The Kubernetes Cluster](#resetting-the-kubernetes-cluster) - - [Fixing Broken GlusterFS Repo](#fixing-broken-glusterfs-repo) - [License](#license) - [Author Information](#author-information) @@ -425,6 +425,12 @@ The key's randomart image is: +----[SHA256]-----+ ``` +##### Fixing Broken GlusterFS Repo +If you experience the following [issue](https://github.com/mrlesmithjr/ansible-rpi-k8s-cluster/issues/7) you can +run the playbook [fix_glusterfs_repo.yml](playbooks/fix_glusterfs_repo.yml) which +will remove the broken `3.10` repo. Once that is done you should be good to go +and be able to run [deploy.yml](playbooks/deploy.yml) once again. + ### Managing WI-FI On First Node To manage the WI-FI connection on your first node. You can create a `wifi.yml` @@ -873,12 +879,6 @@ run the following `Ansible` playbook which will take care of that for you. ansible-playbook -i inventory/ playbooks/reset_cluster.yml ``` -## Fixing Broken GlusterFS Repo -If you experience the following [issue](https://github.com/mrlesmithjr/ansible-rpi-k8s-cluster/issues/7) you can -run the playbook [fix_glusterfs_repo.yml](playbooks/fix_glusterfs_repo.yml) which -will remove the broken `3.10` repo. Once that is done you should be good to go -and be able to run [deploy.yml](playbooks/deploy.yml) once again. - ## License MIT From 5170739c0eeb0c10334cb38151201b91bb32104d Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Thu, 3 May 2018 13:02:28 -0400 Subject: [PATCH 3/5] WIP: Addresses #8 --- inventory/group_vars/all/k8s.yml | 2 ++ playbooks/bootstrap.yml | 2 +- requirements.yml | 1 + roles/ansible-k8s/defaults/main.yml | 2 ++ roles/ansible-k8s/meta/.galaxy_install_info | 2 +- roles/ansible-k8s/tasks/debian.yml | 13 +++++++++++++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/inventory/group_vars/all/k8s.yml b/inventory/group_vars/all/k8s.yml index a721f64..26e0b75 100644 --- a/inventory/group_vars/all/k8s.yml +++ b/inventory/group_vars/all/k8s.yml @@ -17,3 +17,5 @@ k8s_pod_network_config: "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl k8s_users: - user: pi + +k8s_version: 1.9.3 diff --git a/playbooks/bootstrap.yml b/playbooks/bootstrap.yml index 624d188..cd72693 100644 --- a/playbooks/bootstrap.yml +++ b/playbooks/bootstrap.yml @@ -236,7 +236,7 @@ # delay: 2 # with_items: "{{ groups['rpi_k8s_slaves'] }}" -- hosts: rpi_k8s_slaves +- hosts: rpi_k8s any_errors_fatal: true tasks: - name: Updating /etc/hosts diff --git a/requirements.yml b/requirements.yml index 3b9322b..4959ad2 100644 --- a/requirements.yml +++ b/requirements.yml @@ -7,6 +7,7 @@ - src: https://github.com/mrlesmithjr/ansible-glusterfs.git - src: https://github.com/mrlesmithjr/ansible-isc-dhcp.git - src: https://github.com/mrlesmithjr/ansible-k8s.git + version: v1.1.0 - src: https://github.com/mrlesmithjr/ansible-ntp.git - src: https://github.com/mrlesmithjr/ansible-sshd.git - src: https://github.com/mrlesmithjr/ansible-timezone.git diff --git a/roles/ansible-k8s/defaults/main.yml b/roles/ansible-k8s/defaults/main.yml index 19b0ae3..2ab0e31 100644 --- a/roles/ansible-k8s/defaults/main.yml +++ b/roles/ansible-k8s/defaults/main.yml @@ -58,3 +58,5 @@ k8s_token_file: /etc/kubernetes/.k8s_token k8s_users: - user: vagrant + +k8s_version: 1.10.2 diff --git a/roles/ansible-k8s/meta/.galaxy_install_info b/roles/ansible-k8s/meta/.galaxy_install_info index 806d14c..2a6272f 100644 --- a/roles/ansible-k8s/meta/.galaxy_install_info +++ b/roles/ansible-k8s/meta/.galaxy_install_info @@ -1 +1 @@ -{install_date: 'Fri Feb 16 02:20:37 2018', version: ''} +{install_date: 'Thu May 3 12:16:46 2018', version: v1.1.0} diff --git a/roles/ansible-k8s/tasks/debian.yml b/roles/ansible-k8s/tasks/debian.yml index 6b8687a..63ca7fd 100644 --- a/roles/ansible-k8s/tasks/debian.yml +++ b/roles/ansible-k8s/tasks/debian.yml @@ -20,6 +20,19 @@ state: present become: true +- name: debian | Pinning K8s Version + template: + src: etc/apt/preferences.d/k8s.pref.j2 + dest: /etc/apt/preferences.d/k8s.pref + become: true + register: _k8s_pinned_version + +- name: debian | Updating Apt Cache + apt: + update_cache: true + become: true + when: _k8s_pinned_version['changed'] + - name: debian | Installing K8s Packages apt: name: "{{ item }}" From 5ce6b577898cf45cf2ce61e9dd44592cbf39301d Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Thu, 3 May 2018 13:02:28 -0400 Subject: [PATCH 4/5] WIP: Addresses #8 --- inventory/group_vars/all/k8s.yml | 2 ++ playbooks/bootstrap.yml | 2 +- requirements.yml | 1 + roles/ansible-k8s/defaults/main.yml | 2 ++ roles/ansible-k8s/meta/.galaxy_install_info | 2 +- roles/ansible-k8s/tasks/debian.yml | 13 +++++++++++++ .../templates/etc/apt/preferences.d/k8s.pref.j2 | 11 +++++++++++ 7 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 roles/ansible-k8s/templates/etc/apt/preferences.d/k8s.pref.j2 diff --git a/inventory/group_vars/all/k8s.yml b/inventory/group_vars/all/k8s.yml index a721f64..26e0b75 100644 --- a/inventory/group_vars/all/k8s.yml +++ b/inventory/group_vars/all/k8s.yml @@ -17,3 +17,5 @@ k8s_pod_network_config: "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl k8s_users: - user: pi + +k8s_version: 1.9.3 diff --git a/playbooks/bootstrap.yml b/playbooks/bootstrap.yml index 624d188..cd72693 100644 --- a/playbooks/bootstrap.yml +++ b/playbooks/bootstrap.yml @@ -236,7 +236,7 @@ # delay: 2 # with_items: "{{ groups['rpi_k8s_slaves'] }}" -- hosts: rpi_k8s_slaves +- hosts: rpi_k8s any_errors_fatal: true tasks: - name: Updating /etc/hosts diff --git a/requirements.yml b/requirements.yml index 3b9322b..4959ad2 100644 --- a/requirements.yml +++ b/requirements.yml @@ -7,6 +7,7 @@ - src: https://github.com/mrlesmithjr/ansible-glusterfs.git - src: https://github.com/mrlesmithjr/ansible-isc-dhcp.git - src: https://github.com/mrlesmithjr/ansible-k8s.git + version: v1.1.0 - src: https://github.com/mrlesmithjr/ansible-ntp.git - src: https://github.com/mrlesmithjr/ansible-sshd.git - src: https://github.com/mrlesmithjr/ansible-timezone.git diff --git a/roles/ansible-k8s/defaults/main.yml b/roles/ansible-k8s/defaults/main.yml index 19b0ae3..2ab0e31 100644 --- a/roles/ansible-k8s/defaults/main.yml +++ b/roles/ansible-k8s/defaults/main.yml @@ -58,3 +58,5 @@ k8s_token_file: /etc/kubernetes/.k8s_token k8s_users: - user: vagrant + +k8s_version: 1.10.2 diff --git a/roles/ansible-k8s/meta/.galaxy_install_info b/roles/ansible-k8s/meta/.galaxy_install_info index 806d14c..2a6272f 100644 --- a/roles/ansible-k8s/meta/.galaxy_install_info +++ b/roles/ansible-k8s/meta/.galaxy_install_info @@ -1 +1 @@ -{install_date: 'Fri Feb 16 02:20:37 2018', version: ''} +{install_date: 'Thu May 3 12:16:46 2018', version: v1.1.0} diff --git a/roles/ansible-k8s/tasks/debian.yml b/roles/ansible-k8s/tasks/debian.yml index 6b8687a..63ca7fd 100644 --- a/roles/ansible-k8s/tasks/debian.yml +++ b/roles/ansible-k8s/tasks/debian.yml @@ -20,6 +20,19 @@ state: present become: true +- name: debian | Pinning K8s Version + template: + src: etc/apt/preferences.d/k8s.pref.j2 + dest: /etc/apt/preferences.d/k8s.pref + become: true + register: _k8s_pinned_version + +- name: debian | Updating Apt Cache + apt: + update_cache: true + become: true + when: _k8s_pinned_version['changed'] + - name: debian | Installing K8s Packages apt: name: "{{ item }}" diff --git a/roles/ansible-k8s/templates/etc/apt/preferences.d/k8s.pref.j2 b/roles/ansible-k8s/templates/etc/apt/preferences.d/k8s.pref.j2 new file mode 100644 index 0000000..2ca34ed --- /dev/null +++ b/roles/ansible-k8s/templates/etc/apt/preferences.d/k8s.pref.j2 @@ -0,0 +1,11 @@ +Package: kubeadm +Pin: version {{ k8s_version }}* +Pin-Priority: 900 + +Package: kubectl +Pin: version {{ k8s_version }}* +Pin-Priority: 900 + +Package: kubelet +Pin: version {{ k8s_version }}* +Pin-Priority: 900 From e65bed48324428bf73cbaf014843b41f25d2980b Mon Sep 17 00:00:00 2001 From: Larry Smith Jr Date: Thu, 23 Aug 2018 14:19:02 -0400 Subject: [PATCH 5/5] Updated K8s version --- inventory/group_vars/all/k8s.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inventory/group_vars/all/k8s.yml b/inventory/group_vars/all/k8s.yml index 26e0b75..43f5df6 100644 --- a/inventory/group_vars/all/k8s.yml +++ b/inventory/group_vars/all/k8s.yml @@ -14,8 +14,9 @@ k8s_helm_install: true k8s_helm_version: 2.8.1 k8s_pod_network_config: "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')" +# k8s_pod_network_config: https://gist.githubusercontent.com/mrlesmithjr/eab451b45641db6c108ca3f362563621/raw/93569a17d4085975fc2305ae117ce720766174ec/weave-daemonset-2.2.0.yaml k8s_users: - user: pi -k8s_version: 1.9.3 +k8s_version: 1.11.2