Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Kubectl connection plugin doesn't seem to work #200

Closed
shanemcd opened this issue Aug 21, 2020 · 2 comments · Fixed by #204
Closed

Kubectl connection plugin doesn't seem to work #200

shanemcd opened this issue Aug 21, 2020 · 2 comments · Fixed by #204
Assignees
Labels
priority/medium type/bug Something isn't working

Comments

@shanemcd
Copy link

SUMMARY

Hello. I'm seeing what looks like a bug in the kubectl connection plugin. More details below.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

kubectl connection plugin

ANSIBLE VERSION
$ ansible --version
ansible 2.9.12
  config file = /home/shanemcd/.ansible.cfg
  configured module search path = ['/home/shanemcd/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/shanemcd/.pyenv/versions/3.6.10/lib/python3.6/site-packages/ansible
  executable location = /home/shanemcd/.pyenv/versions/3.6.10/bin/ansible
  python version = 3.6.10 (default, May 26 2020, 10:22:32) [GCC 10.1.1 20200507 (Red Hat 10.1.1-1)]
CONFIGURATION

Nothing changed

OS / ENVIRONMENT

Seen on both Fedora 32 and CentOS 8

STEPS TO REPRODUCE
---

- name: Prepare data, dispatch job in isolated environment.
  hosts: all
  gather_facts: false
  collections:
    - community.kubernetes

  tasks:
    - command: "whoami"

Invocation:

$ ansible-playbook -c 'community.kubernetes.kubectl' -i 'awx-job-3,' test.yml -e ansible_kubectl_config=/home/shanemcd/awx/awx/playbooks/.kubeconfigea0jqph8 -vvv
EXPECTED RESULTS

The playbook should be successful:

ACTUAL RESULTS

In the following output you can see 'exec', '-i', 'awx-job-3', 'exec', '-i', 'awx-job-3' is repeated twice.

$ ansible-playbook -c 'community.kubernetes.kubectl' -i 'awx-job-3,' test.yml -e ansible_kubectl_config=/home/shanemcd/awx/awx/playbooks/.kubeconfigea0jqph8 -vvv
ansible-playbook 2.9.12
  config file = /home/shanemcd/.ansible.cfg
  configured module search path = ['/home/shanemcd/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/shanemcd/.pyenv/versions/3.6.10/lib/python3.6/site-packages/ansible
  executable location = /home/shanemcd/.pyenv/versions/3.6.10/bin/ansible-playbook
  python version = 3.6.10 (default, May 26 2020, 10:22:32) [GCC 10.1.1 20200507 (Red Hat 10.1.1-1)]
Using /home/shanemcd/.ansible.cfg as config file
Parsed awx-job-3, inventory source with host_list plugin

PLAYBOOK: test.yml ***************************************************************************************************************************************************************************************************************************
1 plays in test.yml

PLAY [Prepare data, dispatch job in isolated environment.] ***********************************************************************************************************************************************************************************
META: ran handlers

TASK [command] *******************************************************************************************************************************************************************************************************************************
task path: /home/shanemcd/awx/awx/playbooks/test.yml:14
<awx-job-3> ESTABLISH kubectl CONNECTION
<awx-job-3> EXEC ['/usr/bin/kubectl', '--kubeconfig', '/home/shanemcd/awx/awx/playbooks/.kubeconfigea0jqph8', 'exec', '-i', 'awx-job-3', 'exec', '-i', 'awx-job-3', '--', '/bin/sh', '-c', "/bin/sh -c 'echo ~ && sleep 0'", '--', '/bin/sh', '-c', "/bin/sh -c 'echo ~ && sleep 0'"]
<awx-job-3> EXEC ['/usr/bin/kubectl', '--kubeconfig', '/home/shanemcd/awx/awx/playbooks/.kubeconfigea0jqph8', 'exec', '-i', 'awx-job-3', 'exec', '-i', 'awx-job-3', '--', '/bin/sh', '-c', '/bin/sh -c \'echo "`pwd`" && sleep 0\'', '--', '/bin/sh', '-c', '/bin/sh -c \'echo "`pwd`" && sleep 0\'']
<awx-job-3> EXEC ['/usr/bin/kubectl', '--kubeconfig', '/home/shanemcd/awx/awx/playbooks/.kubeconfigea0jqph8', 'exec', '-i', 'awx-job-3', 'exec', '-i', 'awx-job-3', '--', '/bin/sh', '-c', '/bin/sh -c \'( umask 77 && mkdir -p "` echo ~/.ansible/tmp `"&& mkdir "` echo ~/.ansible/tmp/ansible-tmp-1598015577.2467408-290097-79381846423191 `" && echo ansible-tmp-1598015577.2467408-290097-79381846423191="` echo ~/.ansible/tmp/ansible-tmp-1598015577.2467408-290097-79381846423191 `" ) && sleep 0\'', '--', '/bin/sh', '-c', '/bin/sh -c \'( umask 77 && mkdir -p "` echo ~/.ansible/tmp `"&& mkdir "` echo ~/.ansible/tmp/ansible-tmp-1598015577.2467408-290097-79381846423191 `" && echo ansible-tmp-1598015577.2467408-290097-79381846423191="` echo ~/.ansible/tmp/ansible-tmp-1598015577.2467408-290097-79381846423191 `" ) && sleep 0\'']
fatal: [awx-job-3]: UNREACHABLE! => changed=false
  msg: 'Failed to create temporary directory.In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in "/tmp", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p "` echo ~/.ansible/tmp `"&& mkdir "` echo ~/.ansible/tmp/ansible-tmp-1598015577.2467408-290097-79381846423191 `" && echo ansible-tmp-1598015577.2467408-290097-79381846423191="` echo ~/.ansible/tmp/ansible-tmp-1598015577.2467408-290097-79381846423191 `" ), exited with result 1'
  unreachable: true

PLAY RECAP ***********************************************************************************************************************************************************************************************************************************
awx-job-3                  : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
Akasurde added a commit to Akasurde/community.kubernetes that referenced this issue Aug 24, 2020
kubectl exec is printed twice in console log.

Fixes: ansible-collections#200

Signed-off-by: Abhijeet Kasurde <[email protected]>
@Akasurde
Copy link
Member

@shanemcd Thanks for reporting this issue. I am able to reproduce the repetition of exec but not able to reproduce the Failed to create a temporary directory. In... error. Could you please let me know the container image used in this example? Problem might be container image specific.

@Akasurde
Copy link
Member

@shanemcd Also, check if #204 solves exec repetition problem.

@Akasurde Akasurde self-assigned this Aug 24, 2020
Akasurde added a commit that referenced this issue Aug 31, 2020
kubectl exec is printed twice in the console log.

Fixes: #200

Signed-off-by: Abhijeet Kasurde <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority/medium type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants