Commit Graph

1865 Commits (master)

Author SHA1 Message Date
David 9d6344aac7
Add support for ntpsec (#11665)
* Add support for ntpsec

* fixup: set default ntp_driftfile based on ntp_package

* fixup: docs
2024-11-25 16:42:56 +00:00
Max Gautier 68718dcb6f
Stricter kubeadm validation (config and runtime checks) (#11710)
* kubeadm: do not ignore preflight errors blindly

The "ignoring all errors" seems to date back to the inception of the
kubeadm support (it was --skip-preflight-check before).

This can mask real errors and prevent users from seeing them.

Do not ignore any errors by default and make the set of ignored errors
configurable.

* download/kubeadm: remove redundant task

The mode is already set by the previous `copy` task.

* Validate kubeadm configs

This should help to fail early when we have invalid kubeadm configs (from
a kubespray bug or a misconfiguration).

* kubeadm-upgrade: remove unnecessary bool cast

* Convert kubeadm join discovery timeout to v1beta4 config

* CI: Ignore kubeadm:Mem errors on some setup.
2024-11-15 06:34:52 +00:00
Max Gautier 1a4567ac29
Remove deprecated key from kubeadmconfig/v1beta4 (#11709)
timeoutForControlPlane has been removed from v1beta4, instead remplaced
by https://kubernetes.io/docs/reference/config-api/kubeadm-config.v1beta4/#kubeadm-k8s-io-v1beta4-Timeouts

The default for the new value are close enough that there is no need to
override them.
2024-11-14 08:29:13 +00:00
Andreas Gravgaard Andersen 9f88f19e31
remove nameless extraArgs entry (#11703)
* remove nameless extraArgs entry

Signed-off-by: Andreas Gravgaard Andersen <andreasga22@gmail.com>

* fix template name

Signed-off-by: Andreas Gravgaard Andersen <andreasga22@gmail.com>

---------

Signed-off-by: Andreas Gravgaard Andersen <andreasga22@gmail.com>
2024-11-13 17:52:48 +00:00
Kubernetes Prow Robot 91a77e417c
Merge pull request #11674 from tico88612/feat/kubeadm-v1beta4
Feat: kubeadm v1beta4 support
2024-11-08 13:34:44 +00:00
Max Gautier bf6687b032
preinstall: fix checking that excluded host are cached (#11693)
- Lookup was not returning a list, making the difference filter spit out
  garbage -> query always return a list
- hostvars is a dictionnary, so convert to list before selectattr and
  map back to only get keys
2024-11-07 10:27:33 +00:00
ChengHao Yang 1ec6711e95
Feat: add kubeadm-controlplane.yaml support v1beta4
Currently there is not much difference between the files, if there are more changes in the future,
please use different files to distinguish them (you can use the kubeadm_config_api_version variable)

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2024-11-05 23:35:57 +08:00
ChengHao Yang 53e5d8b392
Feat: add kubeadm-client.conf support v1beta4
Remove kubeadm api version condition.
Currently there is not much difference between the files, if there are more changes in the future,
please use different files to distinguish them (you can use the kubeadm_config_api_version variable)

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2024-11-05 23:35:57 +08:00
ChengHao Yang 5929935a19
Refactor: use kubeadm_config_api_version variable
I added the kubeadm_config_api_version variable in the previous commit,
and remove kubeadm api version condition.

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2024-11-05 23:35:57 +08:00
ChengHao Yang 9317e7ef25
Feat: add template kubeadm-config.yaml support v1beta4
v1beta4 has changed a lot in this file (e.g. ExtraArgs etc.), so it was implemented in separate files.

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2024-11-05 23:35:57 +08:00
Kubernetes Prow Robot a469c1c955
Merge pull request #11688 from VannTen/cleanup/preinstall_package_selection
Simplify package selection + fix openEuler package
2024-11-05 10:33:29 +00:00
Max Gautier e1392c65b4
Fix openEuler packages
conntrack -> conntrack-tools
device-mapper-libs -> device-mapper
2024-11-05 09:36:40 +01:00
Max Gautier 8ff4ad2d8e
preinstall: simplify OS packages selection
Since a2019c1c2 (Add a JSON schema describing the packages install
structure, 2024-04-25), we use a custom structure to select which
packages should be installed on a particular host OS.

This has proven too rigid in practice, and the query is pretty
complicated.

Replace this by simply using an array of jinja conditions for the
packages, which should be easier to understand for everyone and more
flexible.

Also remove the associated schema and validation which are no longer
needed.
2024-11-05 09:35:50 +01:00
ChengHao Yang a070c72214
Refactor: simpify external_cloud_provider is defined
For this change, `external_cloud_provider` set default value to empty
string.

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2024-11-05 08:32:39 +08:00
ChengHao Yang 38cd05c503
Refactor: simpify cloud_provider is defined condition
For this change, `cloud_provider` change the default value to empty
string.

Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2024-11-05 08:32:39 +08:00
ChengHao Yang c27cc33bd7
Refactor: var kube_override_hostname only reserve in kubespray-defaults
Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2024-11-05 01:00:39 +08:00
ChengHao Yang 437026f514
Cleanup: remove all cloud_provider related tasks & files
Signed-off-by: ChengHao Yang <17496418+tico88612@users.noreply.github.com>
2024-11-05 00:51:00 +08:00
Kubernetes Prow Robot 3f027abae6
Merge pull request #11598 from VannTen/cleanup/fact_gathering
Do not serialize fact gathering for no_proxy
2024-10-31 10:59:26 +00:00
kyrie 693eb74f52
fix kube-vip container securityContext (#11647) 2024-10-21 17:42:52 +01:00
Max Gautier b0fb06054e
Assert correct limit usage
This should prevent confusing errors with undefined variables
2024-10-04 14:20:30 +02:00
Max Gautier 2826b357d4
Remove serialized collect of ansible_default_ipv4
The fallback_ips tasks are essentially serializing the gathering of one
fact on all the hosts, which can have dramatic performance implications
on large clusters (several minutes).

This is essentially a reversal of 35f248dff0
Being able to run without refreshing the cache facts is not worth it.

We keep fallback_ip for now, simply changing the access to a normal
hostvars variable instead of a custom dictionnary.
2024-10-04 14:19:20 +02:00
Kubernetes Prow Robot bbd90f7657
Merge pull request #11568 from VannTen/cleanup/dont_rely_on_kube_node_existing
Only require minimum structure in inventory, part II
2024-09-27 11:30:02 +01:00
Max Gautier fbcc8cc336
control-plane: refactor group membership test
Testing with group_names does not require the groups to exist.
2024-09-24 11:16:32 +02:00
Max Gautier 9f45552201
Cleanup redundancy
k8s_cluster = kube_control_plane + kube_node
2024-09-24 11:16:30 +02:00
Max Gautier a2a2dfa419
k8s/control-plane: cleanup excessive defaulting 2024-09-23 20:37:56 +02:00
Max Gautier baf0a331c9
Don't generate static tokens for nodes and control planes
Nodes to api-server relies by default certificates, and bootstrap
tokens, and there should be no need to generate tokens for every nodes,
even when enabling static token auth.
2024-09-23 16:58:42 +02:00
Kubernetes Prow Robot 03a055c383
Merge pull request #10643 from VannTen/cleanup/k8s_node_templates
Refactor kubernetes/node templates
2024-09-23 14:16:00 +01:00
Max Gautier 2ec1c93897
Test group membership with group_names
Testing for group membership with group names makes Kubespray more
tolerant towards the structure of the inventory.
Where 'inventory_hostname in groups["some_group"] would fail if
"some_group" is not defined, '"some_group" in group_names' would not.
2024-09-21 14:09:09 +02:00
Kubernetes Prow Robot 93ee1226eb
Merge pull request #11521 from VannTen/cleanup/deduplicate_kubeadm_control_plane
Use in inventory variables rather than patch files for kubeadm_patches
2024-09-20 01:05:14 +01:00
Kubernetes Prow Robot 893e9cb177
Merge pull request #11471 from VannTen/feat/config_plugin_list
Update the list of admission plugins which needs config
2024-09-18 13:18:44 +01:00
Max Gautier c3de25c782
Move the CRI endpoint setting to kubelet config (#11550)
The `--container-runtime-endpoint` kubelet argument is deprecated in
favor of the config file alternative.
2024-09-18 01:34:45 +01:00
Max Gautier c87097fc35
Document how to use kubeadm patches 2024-09-12 10:31:09 +02:00
Max Gautier 8e254ec1e8
kubeadm: allow to provide patch inline in inventories
Specifying one directory for kubeadm patches is not ideal:
1. It does not allow working with multiples inventories easily
2. No ansible templating of the patch
3. Ansible path searching can sometimes be confusing

Instead, provide the patch directly in a variable, and add some quality
of life to handle components targeting and patch ordering more
explicitly (`target` and `type` which are translated to the kubeadm
scheme which is based on the file name)
2024-09-10 20:37:14 +02:00
Max Gautier a8b66fd207
Deduplicate kubeadm_patches tasks
kubernetes/control-plane and kubernetes/kubeadm roles both push kubeadm
patches in the same way.
Extract that code and make it a dependency of both.
This is safe because it's only configuration for kubeadm, which only
takes effect when kubeadm is run.
2024-09-10 17:39:31 +02:00
M. Hamzah Khan d54cfba6c2
Fix SAN check on newer versions versions of openssl (#11277) 2024-09-09 10:04:27 +01:00
Max Gautier fe60832a02
Remove kubelet_node_{custom_flags,config_extra_args}
There is no need to have an extra variables for this, just use different
values per host (using Ansible group_vars, for example)
2024-09-06 09:35:34 +02:00
Max Gautier 1bc61c9f35
Simplify kubelet-config template
Remove system|kube_master_<resource>_reserved variables.
Those variables are unnecessary because users can simply use the
variables in group_vars if they which to differentiate control plane
nodes from other nodes.

Set conservative defaults for ephemeral-storage and pids for both kube
and system reserved resources.
2024-09-06 09:33:07 +02:00
Max Gautier 1533d40411
Fix kube_reserved_cgroups_for_service_slice
The default value is used across kubespray but only defined in
kubernetes/node.
Move it to kubespray-defaults
2024-09-06 09:25:23 +02:00
Bogdan Sass 4b324cb0f0
Rename master to control plane - non-breaking changes only (#11394)
K8s is moving away from the "master" terminology, so kubespray should follow the same naming conventions. See 65d886bb30/sig-architecture/naming/recommendations/001-master-control-plane.md
2024-09-06 07:56:19 +01:00
Max Gautier 7f527f6195
Drop support for RHEL 7 / CentOS 7 (#11246)
* Simplify docker systemd unit

systemd handles missing unit by ignoring the dependency so we don't need
to template them.

* Remove RHEL 7/CentOS 7 support

- remove ref in kubespray roles
- move CI from centos 7 to 8
- remove docs related to centos7

* Remove container-storage-setup

Only used for RHEL 7 and CentOS 7
2024-09-05 07:41:01 +01:00
Takuya Murakami c89ea7e4c7
Fix: remove --config option from kubeadm upgrade (#11350) (#11352)
We can't mix some options with --config for kubeadm upgrade.
The --config on upgrade is deprecated, and should be removed.
2024-08-29 03:08:29 +01:00
Selçuk Arıbalı 3d9e4951ce
fix static api server advertise address (#11457) 2024-08-28 15:20:56 +01:00
Max Gautier 776b40a329
Adjust task name since we allow empty kube_node (#11474) 2024-08-28 06:35:02 +01:00
Vlad Korolev 9a7b021eb8
Do not use ‘yes/no’ for boolean values (#11472)
Consistent boolean values in ansible playbooks
2024-08-28 06:30:56 +01:00
Max Gautier 5b057c7328
Update list of admission plugins with a config file 2024-08-26 14:53:20 +02:00
Max Gautier d3402736d4
Remove special case for PodNodeSelector
This is already handled by the previous task.
2024-08-26 14:43:00 +02:00
Max Gautier 47c3949477
Change plugins_needs_config list format
Makes easier diff when adding or removing plugins.
2024-08-26 14:42:04 +02:00
Ho Kim fe4cbbccd1
fix: correct resolvconf typo (#11439) 2024-08-14 02:07:55 -07:00
Selçuk Arıbalı e43e08c7d1
fix: use super-admin.conf for kube-vip on first master when it exists (#11422)
* fix: use super-admin.conf for kube-vip when it exists

* Mathieu Parent add as co-author

Co-authored-by: Mathieu Parent <math.parent@gmail.com>

* template change for readability

* fix lint error

---------

Co-authored-by: Mathieu Parent <math.parent@gmail.com>
2024-08-10 21:35:58 -07:00
Slavi Pantaleev cc03ca62be
Avoid empty "supersede domain-name-servers" directives for dhclient.conf (#10948)
Fixes https://github.com/kubernetes-sigs/kubespray/issues/10947

This patch aims to be minimal and intentionally:

- does not change the generation logic for `supersede_domain` and `supersede_search`
- does not change how `nameserverentries` (for NetworkManager) is built

It seems like `nameserverentries` in the "Generate nameservers for resolvconf, including cluster DNS"
task is built the same way as `dhclient_supersede_nameserver_entries_list`.
However, `nameserverentries` in the "Generate nameservers for resolvconf, not including cluster DNS"
task (below) is built differently for some reason. It includes `configured_nameservers` as well.
Due to these differences, I have refrained from reusing the same building logic
(`dhclient_supersede_nameserver_entries_list`) for both.

If the `configured_nameservers` addition can be removed or made to apply
to dhclient as well, we could potentially build a single list and then
generate the `nameserverentries` and `supersede_nameserver` strings from it.
2024-08-06 03:38:51 -07:00