CrashLoopBackOff when args are added in Kubernetes

This deployment is fine until I add args (added below) to the deployment. I can’t figure out why it would turn into a CrashLoopError when adding simple args. I even tried to echo Hello World and it still results in a CrashLoopError.

There are no logs and when I describe the pod it shows:

  • Save docker container settings like port mapping and volumes
  • Is there a way to use the same Docker container for all apps?
  • Dockerfile with LAMP running (Ubuntu)
  • Docker volumes mount binding permissions difference between maven build and docker cli
  • Permission denied for protoc on maven build in Teamcity
  • Why does Liquibase migration on MySQL database die after acquiring lock on DC/OS (worked fine with docker-compose)?
  • Warning     FailedSync  Error syncing pod, skipping: failed to "StartContainer" for "nginx" with CrashLoopBackOff: "Back-off 10s restarting failed container=nginx pod=nginx-2247906467-r9znh_dave-testing(98c3999e-c39b-11e6-936e-0050568b4a68)"
    

    and here is the YAML:

    - kind: Deployment
      apiVersion: extensions/v1beta1
      metadata:
        name: nginx
      spec:
        replicas: 1
        template:
          metadata:
            labels:
              name: nginx
              version: "1.9"
          spec:
            containers:
            - name: nginx
              imagePullPolicy: Always
              image: "nginx:1.9"
              ports:
              - containerPort: 80
              args:
              - "echo $NGINX_CONF > /etc/nginx/nginx.conf"
              env:
              - name: NGINX_CONF
                valueFrom:
                  secretKeyRef:
                    name: confs
                    key: nginx
    

  • Emulating Raspberry Pi with Docker on OS X
  • What's benefit of docker's image layer?
  • mongodb with docker-compose [SocketTimeoutException]
  • ffmpeg build from source fails in docker container?
  • Tomcat Docker Container: host webapp directory mounted as container webapp directory
  • Asked password when ssh to container
  • One Solution collect form web for “CrashLoopBackOff when args are added in Kubernetes”

    Here is a working version of Kubernetes Pod with nginx alpine docker image:

    apiVersion: v1
    kind: Pod
    metadata:
      name: frontend-nginx-pod
      labels:
        app: nginx-test
    spec:
      containers:
        - name: nginx
          image: nginx:1.11.6-alpine
          ports:
            - containerPort: 80
              name: "http-server"
          args:
          - /bin/sh
          - -c
          - echo "hello" > /usr/share/nginx/html/index.html && nginx "-g daemon off;"
    

    I was getting the same error without listing args as above.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.