Skip to content

Etcd Certificates are not generated when adding nodes to an existing cluster with scale.yml #12120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions playbooks/cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
- { role: download, tags: download, when: "not skip_downloads" }

- name: Install etcd
vars:
etcd_cluster_setup: true
etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}"
import_playbook: install_etcd.yml

- name: Install Kubernetes nodes
Expand Down
3 changes: 0 additions & 3 deletions playbooks/install_etcd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,4 @@
- { role: kubespray-defaults }
- role: etcd
tags: etcd
vars:
etcd_cluster_setup: true
etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}"
when: etcd_deployment_type != "kubeadm"
21 changes: 5 additions & 16 deletions playbooks/scale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,11 @@
- name: Gather facts
import_playbook: facts.yml

- name: Generate the etcd certificates beforehand
hosts: etcd:kube_control_plane
gather_facts: false
any_errors_fatal: "{{ any_errors_fatal | default(true) }}"
environment: "{{ proxy_disable_env }}"
roles:
- { role: kubespray-defaults }
- role: etcd
tags: etcd
vars:
etcd_cluster_setup: false
etcd_events_cluster_setup: false
Comment on lines -17 to -19
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only slight concern I have is this, which differs in install-etcd.yml.

However this only affect 'etcd', so it would only be a problem for using scale.yml with etcd nodes, which is not supported. I wonder if we have an easy way to fail early if something like this is attempted 🤔

Maybe that's out of scope for this though.

@tico88612 @ant31 thoughts ?

Copy link
Contributor

@ant31 ant31 Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we set the variables in the import? or with set fact before ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value for etcd_cluster_setup is set to true. However, this can be changed to false by configuring the variables in scale.yaml.

https://github.com/kubernetes-sigs/kubespray/blob/master/roles/etcd/defaults/main.yml#L6

@VannTen and @ant31 please review my changes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, I don't why I thought we could not set vars on import_playbook.

In that case we'd define in both cases at import_playbook level and be done with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

when:
- etcd_deployment_type != "kubeadm"
- kube_network_plugin in ["calico", "flannel", "canal", "cilium"] or cilium_deploy_additionally | default(false) | bool
- kube_network_plugin != "calico" or calico_datastore == "etcd"
- name: Install etcd
vars:
etcd_cluster_setup: false
etcd_events_cluster_setup: false
import_playbook: install_etcd.yml

- name: Download images to ansible host cache via first kube_control_plane node
hosts: kube_control_plane[0]
Expand Down
3 changes: 3 additions & 0 deletions playbooks/upgrade_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
- { role: container-engine, tags: "container-engine", when: deploy_container_engine }

- name: Install etcd
vars:
etcd_cluster_setup: true
etcd_events_cluster_setup: "{{ etcd_events_cluster_enabled }}"
import_playbook: install_etcd.yml

- name: Handle upgrades to control plane components first to maintain backwards compat.
Expand Down