Specify in Kubernetes deployment that image must be run in interactive mode

6/7/2018

I have an image that needs to be run in interactive mode (or else I get EOFError: EOF when reading a line).

docker run -i imagename

Everything works fine when I run it in interactive mode but how do I specify that in the deployment YAML file?

My YAML looks like this:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: stackoverflow
spec:
  replicas: 2
  minReadySeconds: 15
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
  template:
    metadata:
      labels:
        app: stackoverflow
    spec:
      containers:
        - image: stackoverflow
          imagePullPolicy: Always
          name: stackoverflow
          ports:
            - containerPort: 80
-- Stanko
docker
kubernetes

1 Answer

6/7/2018

Everything works fine when I run it in interactive mode but how do I specify that

  • in our statefusets (should work for deployments as well) we use following:

    ...
    containers:
      - image: stackoverflow
        name: stackoverflow
        stdin: true
        tty: true
        ...

    note that docker flag -i corresponds to stdin, and flag -t to tty in container specification.

As requested, here is v1.10 documentation reference for container spec:

-- Const
Source: StackOverflow