I have a privileged pod running in a demo k8s cluster and I can run the below command to list files on the hostnode in /var/tmp
:
$ kubectl exec debug-pod-d2qpj chroot /host ls /var/tmp
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
cloud-init
samples
systemd-private-89...
systemd-private-89..
But I cannot add the option -la
it just gives:
$ kubectl exec debug-pod-d2qpj chroot /host ls -la /var/tmp
Error: unknown shorthand flag: 'l' in -la
See 'kubectl exec --help' for usage.
I have tried various ways to quote the command/options but no luck so far.
Any suggestions?
CodePudding user response:
The syntax for kubectl exec uses --
to indicate the remaining flags shouldn't be processed by kubectl:
kubectl exec debug-pod-d2qpj -- chroot /host ls -la /var/tmp