FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'kubernetes.core.kustomize'. Error was a <class 'FileNotFoundError'>, o riginal message: [Errno 2] No such file or directory: '/usr/local/bin/kubectl'. [Errno 2] No such file or directory: '/usr/local/bin/kubectl'"} #664
Labels
needs_info
Needs additional information from original reporter
SUMMARY
I am trying to use the kustomize anisble module but unable to execute it. Kubernetes resources are not creating.
Kubernetes node is having kubectl binary
/usr/local/bin/kubectl version
Client Version: v1.28.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.28.2
ISSUE TYPE
Code:
k8s:
definition: "{{ lookup('kubernetes.core.kustomize', dir='../hybrid-cloud/kustomization.yaml', binary_path='/usr/local/bin/kubectl') }}"
Error1:
FAILED! => {"msg": "An unhandled exception occurred while running the lookup plugin 'kubernetes.core.kustomize'. Error was a <class 'FileNotFoundError'>, o
riginal message: [Errno 2] No such file or directory: '/usr/local/bin/kubectl'. [Errno 2] No such file or directory: '/usr/local/bin/kubectl'"}
Code:
k8s:
definition: "{{ lookup('kubernetes.core.kustomize', dir='../hybrid-cloud/kustomization.yaml') }}"
Error2:
FAILED! => {"msg": "Failed to find required executable 'kubectl' and 'kustomize' in paths"}
COMPONENT NAME
kubernetes.core.kustomize
ANSIBLE VERSION
COLLECTION VERSION
ansible-galaxy collection list kubernetes.core
/home/test-user/.ansible/collections/ansible_collections
Collection Version
kubernetes.core 2.4.0
OS / ENVIRONMENT
uname -a
Linux ansible-master 4.18.0-425.13.1.el8_7.x86_64 #1 SMP Thu Feb 2 13:01:45 EST 2023 x86_64 x86_64 x86_64 GNU/Linux
[test-user@ansible-master tasks]$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.8 (Ootpa)"
STEPS TO REPRODUCE
below or the syntax i tried:
name: Run lookup using kubectl
set_fact:
resources: "{{ lookup('kubernetes.core.kustomize', binary_path='/usr/local/bin/kubectl') }}"
name: Run lookup
set_fact:
resources: "{{ lookup('kubernetes.core.kustomize', dir='../hybrid-cloud/kustomization.yaml', binary_path='/usr/local/bin/kubectl') }}"
name: Create kubernetes resources for lookup output
k8s:
definition: "{{ lookup('kubernetes.core.kustomize', dir='../hybrid-cloud/kustomization.yaml', binary_path='/usr/local/bin/kubectl') }}"
EXPECTED RESULTS
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: