generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 155
Open
Labels
Description
SUMMARY
The k8s_cp
module doesn't support initContainers. When specifying the container
parameter value as the name of an initContainer it still fails with the error: Pod has no container container-name
ISSUE TYPE
- Bug Report
COMPONENT NAME
k8s_cp
ANSIBLE VERSION
ansible [core 2.18.1]
config file = /home/x1/Documents/deployment/ansible.cfg
configured module search path = ['/home/x1/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /home/x1/Documents/deployment/collections-galaxy
executable location = /usr/bin/ansible
python version = 3.13.3 (main, Jun 16 2025, 18:15:32) [GCC 14.2.0] (/usr/bin/python3)
jinja version = 3.1.5
libyaml = True
COLLECTION VERSION
- name: kubernetes.core.git
type: git
version: 6.0.0
STEPS TO REPRODUCE
- name: Copy local tiledata to remote
delegate_to: 127.0.0.1
kubernetes.core.k8s_cp:
local_path: "{{ tileserver_gl_tiledata_local_directory }}/{{ tileserver_gl_tiledata_local_filename }}"
namespace: "{{ tileserver_gl_helm_namespace }}"
pod: "{{ selected_tileserver_gl_pods.metadata.name }}"
container: "tileserver-gl-init"
remote_path: "{{ tileserver_gl_tiledata_temp_remote_path }}"
no_preserve: true
tags: tileserver-gl
EXPECTED RESULTS
I expected the module to copy data into initContainers the same as normal containers.
ACTUAL RESULTS
The task failed with the error Pod has no container container-name
TASK [role : Copy local data to remote] ************************************************************************************
fatal: [node-01 -> 127.0.0.1]: FAILED! =>
changed: false
msg: Pod has no container container-name