Skip to content

Inconsistent selection of k8s_master #10

@teq0

Description

@teq0

I was having a strange thing where after a certain point in the deployment it would suddenly think that the cluster master was the first slave node, not the actual master node, leading to all sorts of weird behaviour.

The way the k8s_master is selected in roles/ansible-k8s/tasks/set_facts.yml is

- name: set_facts | Setting K8s Master
  set_fact:
    k8s_master: "{{ groups[k8s_master_group][0] }}"
  tags:
    - k8s_get_dashboard

However ordering in a group is not guaranteed, it's a python list, which aren't ordered (see ansible/ansible#31735).

A fix would be to have it look instead at groups["rpi_k8s_master"][0], rather than the rpi_k8s group, which has all the nodes in it.

The other place that this happens is in roles/ansible-k8s/defaults/main.yml, except here it's

k8s_cluster_group: k8s

I can't see how that works at all, k8s isn't even a group. I assume it's being overwritten in the task.

I have a PR ready to go that I think fixes these.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions