Can't run a docker container on kubernetes in the interactive mode

4/18/2016

Here is a post about kubectl run command - http://kubernetes.io/docs/user-guide/kubectl/kubectl_run/

I have tried to run the docker container with the -i option, like in the example:

# Start a single instance of busybox and keep it in the foreground, don't restart it if it exits.
kubectl run -i --tty busybox --image=busybox --restart=Never

However, kubectl says that -i is an unknown command.

Error: unknown shorthand flag: 'i' in -i
Run 'kubectl help' for usage.

Any ideas?

-- experimenter
amazon-web-services
docker
kubernetes

1 Answer

4/19/2016

It's likely that your kubectl client is out of date, because your command line works for me:

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.0", GitCommit:"5cb86ee022267586db386f62781338b0483733b3", GitTreeState:"clean"}
Server Version: version.Info{Major:"1", Minor:"2", GitVersion:"v1.2.2", GitCommit:"528f879e7d3790ea4287687ef0ab3f2a01cc2718", GitTreeState:"clean"}

$ kubectl run -i --tty busybox --image=busybox --restart=Never
Waiting for pod default/busybox-dikev to be running, status is Pending, pod ready: false

Hit enter for command prompt

/ #
-- Robert Bailey
Source: StackOverflow