<p>I use CentOs 7.4 virtual machine which has 32Gb memory.</p>

<p>I have docker composer, it has following configurations:</p>

<pre><code>version: "2"
services:
  shiny-cas-server:
    image: shiny-cas
    command: puma -C config/puma.rb
    volumes:
      - ./cas-server/logs:/app/logs
      - ./cas-server/config:/app/config
      - ./cas-server/public:/app/public
</code></pre>

<p>With above docker level configuartions, I make kubernetes configuration:</p>

<p>cas-server-depl.yaml:</p>

<pre><code>apiVersion: extensions/v1beta1   
kind: Deployment                 
metadata:                        
  name: cas-server-depl          
spec:                            
  replicas: 1                    
  template:                      
    metadata:                    
      labels:                    
        app: cas-server-pod
    spec:                        
      containers:                
      - name: cas-server-pod     
        image: shiny-cas         
        imagePullPolicy: Never
        command: ["puma -C /cas-server/config/puma.rb"]
        ports:
          - containerPort: 100
        volumeMounts:
          - mountPath: /app/logs
            name: cas-server-logs
          - mountPath: /app/config
            name: cas-server-config
          - mountPath: /app/public
            name: cas-server-public
      volumes:
        - name: cas-server-logs
          hostPath:
            path: /cas-server/logs
        - name: cas-server-config
          hostPath:
            path: /cas-server/config
        - name: cas-server-public
          hostPath:
            path: /cas-server/public
</code></pre>

<p>In virtual machine, I copy <code>./cas-server</code> directory to <code>/cas-server</code>, and changed chown and chgrp as my login name <code>k8s</code>, when I do <code>sudo kubectl apply -f cas-server-depl.yaml</code>, it has following response:</p>

<pre><code>[k8s@k8s config]$ sudo kubectl get po
NAME                               READY     STATUS              RESTARTS   AGE
cas-server-depl-7f849bf94c-srg77   0/1       RunContainerError   1          5s
</code></pre>

<p>Then I use following command to see why:</p>

<pre><code>[k8s@k8s config]$ sudo kubectl describe po cas-server-depl-7988d6b447-ffff5
Name:               cas-server-depl-7988d6b447-ffff5
Namespace:          default
Priority:           0

IP:                 100.68.142.72
Controlled By:      ReplicaSet/cas-server-depl-7988d6b447
Containers:
  cas-server-pod:

    Command:
      puma -C /cas-server/config/puma.rb
    State:          Waiting
      Reason:       CrashLoopBackOff
    Last State:     Terminated
      Reason:       ContainerCannotRun
      Message:      OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"puma -C /cas-server/config/puma.rb\": stat puma -C /cas-server/config/puma.rb: no such file or directory": unknown
      Exit Code:    128
      ...
    Ready:          False
    Restart Count:  2
    Environment:    &lt;none&gt;
    Mounts:
      /app/config from cas-server-config (rw)
      /app/logs from cas-server-logs (rw)
      /app/public from cas-server-public (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-mrkdx (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  cas-server-logs:
    Type:          HostPath (bare host directory volume)
    Path:          /cas-server/logs
    HostPathType:

    HostPathType:
  default-token-mrkdx:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-mrkdx
    Optional:    false


  Normal   Created    15s (x3 over 29s)  kubelet, k8s.xxx.com.cn  Created container
  Warning  Failed     15s (x3 over 28s)  kubelet, k8s.xxx.com.cn  Error: failed to start container "cas-server-pod": Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"puma -C /cas-server/config/puma.rb\": stat puma -C /cas-server/config/puma.rb: no such file or directory": unknown
  Warning  BackOff    1s (x3 over 26s)   kubelet, k8s.shinyinfo.com.cn  Back-off restarting failed container
</code></pre>

<p>It says:   </p>

<pre><code>Message:      OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"puma -C /cas-server/config/puma.rb\": stat puma -C /cas-server/config/puma.rb: no such file or directory": unknown
</code></pre>

<p>I tried <code>/app/config/puma.rb</code> and <code>config/puma.rb</code> in command, both have same error message. which directory I shall write? I could see puma.rb do exists.</p>

<p>My cas-server-svc.yaml is pasted as reference:</p>

<pre><code>apiVersion: v1
kind: Service
metadata:
  name: cas-server-svc
  labels:
    name: cas-server-svc
spec:
  selector:
    app: cas-server-pod
  type: NodePort
  ports:
  - port: 100
    nodePort: 31101
    name: tcp
</code></pre>

<p>When you say</p>

<pre><code>command: ["puma -C /cas-server/config/puma.rb"]
</code></pre>

<p>You are telling Kubernetes to tell Docker to look for a single executable named <code>puma -C ...</code>, where what you think are the command-line options are actually part of the filename.  You need to split out the arguments into separate elements in the YAML list syntax, something like</p>

<pre><code>command: ["puma", "-C", "/cas-server/config/puma.rb"]
</code></pre>

<p>or</p>

<pre><code>command:
  - puma
  - -C
  - /cas-server/config/puma.rb
</code></pre>
