kubernetes.core 6.6.0 Released - Whats New and How to Test
Introduction
The kubernetes.core collection is the official Ansible collection for interacting with Kubernetes clusters, providing modules such as k8s, k8s_info, k8s_cp, helm, helm_info, and related lookup and inventory plugins. It is maintained by the Ansible Cloud team and is one of the dependencies pulled in by the ansible community package.
Version 6.6.0 has just been published on Ansible Galaxy, replacing 6.5.0. This release is not a pure bugfix drop: it ships a number of minor feature additions across the helm, k8s_cp, k8s_info, and k8s lookup/waiter code paths, plus several deprecation notices that collection users should be aware of ahead of future major releases.
Whats New
Helm module improvements
helmgains a newwait_for_jobsoption, which waits for all Jobs to complete before marking a Helm release as successful. This requires Helm >= 3.5.0 (PR #1140).helmgains a newcleanup_on_failoption, mapping to the--cleanup-on-failHelm flag, allowing deletion of new resources created during a failed upgrade. It complementsatomicand can be combined with it, but not withreplace, sincereplacedeploys viahelm install, which does not accept that flag (PR #1206).helmnow warns whenreuse_valuesorreset_then_reuse_valuesis requested in a combination that Helm silently ignores. This happens by default becausereset_valuesdefaults totrue, and whenever either option is combined withreplace. Documentation and examples now clarify thatreset_valuesmust be set tofalsefor either option to take effect (PR #1230).
k8s_cp changes
- New
copy_timeoutoption (default 300 seconds) bounds how longk8s_cpspends streaming an archive to a pod and waiting for the remotetarto finish, so a stalled copy fails instead of hanging indefinitely (PR #1217). - The module now streams the tar archive to the pod chunk by chunk instead of building the whole archive in memory first, reducing peak memory usage when copying large files (PR #1217).
- When copying to a pod,
k8s_cpnow also uses/bin/shandheadinside the container, when present, to confirm the copy completed. Containers without them keep the previous behaviour and get a warning that completion could not be verified (PR #1217).
k8s_info, lookup, and waiter
k8s_infonow supports metadata-only fetches (PR #1030).- The
k8slookup now warns whenENABLE_TURBO_MODEis set but thecloud.commoncollection is not installed, instead of silently falling back to the standard lookup base (PR #1242). - The waiter gains a
job_completepredicate to support waiting for Job resources to reach theCompleteorFailedcondition (issue #1201).
Action groups and internal cleanup
helm_pluginandhelm_plugin_infohave been added to thehelmaction group, andk8s_tainthas been added to thek8saction group, so thatmodule_defaultsset on those groups now applies to them as well (PR #1216).- The remaining
ansible.module_utils.siximport has been removed in favor of the Python standard library equivalent, avoiding deprecation warnings (PR #1197). collections.abcis now used instead of the deprecatedansible.module_utils.common._collections_compat(PR #1057).
Deprecated Features
| Feature | Replacement | Removal Version | Reference |
|---|---|---|---|
ENABLE_TURBO_MODE (Ansible Turbo mode) | n/a (depends on retiring cloud.common) | 8.0.0 | PR #1242 |
helm return value status.values | status.release_values | 8.0.0 | issue #1239 |
helm parameter wait_timeout | timeout | 7.0.0 | issue #1239 |
helm_info return value status.values | status.release_values | 8.0.0 | issue #1239 |
Users relying on ENABLE_TURBO_MODE, status.values, or wait_timeout should start planning a migration path, since these will be removed in upcoming major releases (7.0.0 and 8.0.0).
How to Test
Install or upgrade the collection from Ansible Galaxy and confirm the version:
# Install kubernetes.core 6.6.0 explicitly
ansible-galaxy collection install kubernetes.core:==6.6.0
# Or upgrade to the latest available version
ansible-galaxy collection install kubernetes.core --upgrade
# Verify the installed version
ansible-galaxy collection list kubernetes.core
# Inspect the documentation for the new options
ansible-doc -t module kubernetes.core.helm
ansible-doc -t module kubernetes.core.k8s_cp
ansible-doc -t module kubernetes.core.k8s_info
A quick way to exercise the new helm options in a playbook:
---
- hosts: localhost
gather_facts: false
tasks:
- name: Deploy release, wait for jobs and clean up on failure
kubernetes.core.helm:
name: myrelease
chart_ref: mychart
release_namespace: default
wait: true
wait_for_jobs: true
cleanup_on_fail: true
After installing, review the full changelog fragment in the collection's CHANGELOG.rst or on the Galaxy release page to confirm which fixes and minor changes apply to the environment before rolling this update out to production automation.