Solution Kubectl exec command terminated with exit code 126

The Solution Kubectl exec command terminated with exit code 126,


>kubectl --kubeconfig="config.yaml"  exec --stdin --tty esmartpod-56c88948597-8gn8x --namespace="services" -- /bin/bash

Error:
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown
command terminated with exit code 126

Solution: After investigating the reason why this pod does not has a /bin/bash executable, trying with — /bin/sh instead and et voila is working


>kubectl --kubeconfig="config.yaml"  exec --stdin --tty esmartpod-56c88948597-8gn8x --namespace="services" -- /bin/sh