kubectl exec does not work with xargs. may be am missing right syntax.
I have like 10 nodes to pull the container info.. like run command as cat /etc/nginx/nginx.conf
but my first command itself is failing.
kubectl get nodes -l nodeGroup=test -o wide | awk '{print $1}' | xargs -l1 -- sh -c 'kubectl exec -ti -n kube-system nginx-proxy-$1 sh' --
OR
kubectl get nodes -l nodeGroup=test -o wide | awk '{print $1}' | xargs -l1 -- sh -c 'kubectl exec -ti -n kube-system nginx-proxy-$1 /bin/bash' --
output:
Unable to use a TTY - input is not a terminal or the right kind of file
when i run the same individually, it works. any hint how to loop over it with xargs am using same terminal. below works but above with xargs does not.
▶ kubectl exec -ti -n kube-system nginx-proxy-node1 sh
#