Project31 / ansible-kubernetes-openshift-pi3

Ansible playbooks for setting up a Kubernetes Raspberry Pi 3 cluster
190 stars 55 forks source link

Management Role includes "includes/install_k8s_resource.yml"? #24

Closed robertpeteuil closed 3 years ago

robertpeteuil commented 7 years ago

Is it meant to point to includes/install_binaries.yml?

FYI - i love your repo. It's very clean & it helped proactively fix a lot of problems before they occurred (like the same machine_id on all nodes, etc...)

There are a few tasks that are no longer necessary with HypriotOS 1.5. Should I just list them for you, or would you like me to submit a PR?

rhuss commented 7 years ago

Oops, it looks like that I forgot to add the file. It's meant to be used for applying k8s resources. Just updated it.

thanks for the compliments ;-) Although I'm only able to update the repo from time to time, I'm still committed to it.

If you would have time to submit a PR, that would be awesome! Otherwise, I will update the repo to latest Hypriot and Kubernetes, but can't promise when.

rhuss commented 7 years ago

@robertpeteuil I'm about to update for HypriotOS 1.5 and it would be awesome if you could point me to the tasks which are obsolete now.

robertpeteuil commented 7 years ago

@rhuss Absolutely, I'm happy to share my findings.

First, let me thank you - your repo is great. My original plan was to fork it and submit PRs. Unfortunately, my project requires some substantial changes which made a fork impossible. But, I'll make sure to message you when my repo is posted (and give you proper attribution).

Now - here's the tasks that are obsolete, and some you may want to consider adjusting.

Revisions for HypriotOS 1.5 setup.yml playbook

role: base - file "main.yml"

role: base - file "apt.yml"

role: base - file "system.yml"

role: base - template "hosts"

role: base - file "user.yml"

role: kubernetes - file "kubeadm.yml"

docker notes

There may be a few others that I find. If so, i'll post them in a separate response.

I hope this helps, Robert.

rhuss commented 7 years ago

Hey @robertpeteuil,

thanks a lot for your detailed comments. As you probably have noticed, I'm not really an Ansible expert (tbh, these are my first Ansible playbooks ;-).

I will go through them, and adapt the roles accordingly. 'hope that I can make some progress with some additional addons like rook or traefik soon, too (though no promises, as this year seems to be a crazy busy one).

thanks again ...

robertpeteuil commented 7 years ago

I'm happy to help.

I'd really like to find a way to leverage each other's work,

Let's start by sharing what i've done thus far - I just need to get it cleaned up and posted.

If I don't have time to get it cleaned up for public posting (making a readme), I'll upload as private & make you a collaborator.

robertpeteuil commented 7 years ago

One other item I just remembered.

You have a couple of tasks that reboot the nodes then wait for them to come back online. I found it in the "kubernetes-full-reset", but it might be used in other places.

For me it always waited until the timeout period (60 seconds), until I added "port=22" to the command. Now my nodes return after a reboot in 15-20 seconds (they're overclocked U3 cards.).

wait_for: host={{ inventory_hostname }} port=22 state=started delay=10 timeout=60
rhuss commented 7 years ago

Thanks a lot for everything, I took over most of your suggestions unaltered and tested it afresh on a vanilla setup. Works out quite smoothly ;-)

optional: may want to verify the dhcp tasks still work as expected Only mentioned because I've not tested them because I've implemented static-IP assignment differently

Not sure what you mean with this.


BTW, I would be very happy if we could add your changes, too and eventually even rename the repo to something more suitable (as currently, openshift is a bit out of scope, as long as I can't get hands on a supported ARM binary). Also, if you are feeling committed to the repo, too, I'm perfectly fine to grant write permissions to the project, too, so that we can work in parallel on it. Any suggestions how to proceed?

robertpeteuil commented 7 years ago

Thanks for your kind words, and acknowledgements in the commits.

My comment about "dhcp tasks" just meant that I had not tested that code with Hyp 1.5 - I just meant "FYI, I haven't checked this"

Thank you for your offer and I definitely like to combine our efforts. Unfortunately, I looked into it and merging isn't possible at the moment as our solutions don't map 1:1 right now. (I explain why below) I think the biggest issue is the differences in how we define our inventories. It creates variable mismatches between our solutions (which beaks templates and other things). For example:your "name" == my "inventory_hostname", and your "inventory_hostname" == my "ansible_host".

In the meantime, here's two plays that can replace a shell script you have. As any good ansible script - it only changes it once, so you don't have to worry about the machine-id changing if the script is re-ran (unlike the shell script). I run this in my equivalent of your core role, in the system file:

- name: System | Get machine-id
  shell: cat /etc/machine-id
  register: node_machine_id
  changed_when: False

- name: System | Change machine-id if default
  shell: 'dbus-uuidgen > /etc/machine-id'
  when: node_machine_id.stdout == "d7866798b7e648d38289364f159bec68"
  register: machine_id
  ignore_errors: True

# Then, I also trigger a reboot later on:
  when: machine_id|changed

As I started to mention above - the reason my playbooks and inventory are different is that I'm designing it from the ground up to support multiple "Clusters" of different types (at the same time). This adds a lot of complexity, and I basically started from scratch. I've been able to leverage from your repo and 2 others, but I still need to write a lot of stuff myself. So, I need to get my solution flushed out a bit - then we can determine what and/or how we can merge.

Wow - this ended up being a long post. Sorry for creating the TL/DR entry.

Cheers, Robert.