<p>I am trying to deploy apache docker image using Terraform on Kubernetes Cluster</p>
<p>I tried the following command and able to hit the URL <code>localhost:8082</code> from browser successfully</p>
<pre><code>docker run -it --rm -d -p 8082:80 webservice
</code></pre>
<p>I then created a kubernetes_deployment using Terraform but pod keeps crashing and <code>there's nothing in logs</code></p>
<pre><code>resource &quot;kubernetes_deployment&quot; &quot;api&quot; {
  metadata {
    name = &quot;ex-api&quot;
    labels = {
      app       = &quot;EX&quot;
      component = &quot;api&quot;
    }
  }
  spec {
    replicas = 1
    selector {
      match_labels = {
        app = &quot;EX&quot;
      }
    }
    template {
      metadata {
        name = &quot;ex-api&quot;
        labels = {
          app       = &quot;EX&quot;
          component = &quot;api&quot;
        }
      }
      spec {
        container {
          image             = &quot;${var.web_service_image}:${var.web_service_image_tag}&quot;
          image_pull_policy = &quot;IfNotPresent&quot;
          name              = &quot;api-image&quot;

          # All the other configuration options should be here too.
          port {
            container_port = 80
            name           = &quot;web&quot;
          }
        }  # end of container block

      } # end of spec block
    } # end of template block
  } # end of spec out-block
}
</code></pre>
<p>Pod's output</p>
<pre><code>kubectl get pod
NAME                      READY   STATUS             RESTARTS   AGE
ex-api-5458586bd8-ex6sp   0/1     CrashLoopBackOff   19         72m
</code></pre>
<p>I assume I should either add some <code>command or daemonize</code> (eg -itd when using docker) it so that it keeps running.  I may be wrong here</p>
<p>Kindly let me know what should I do to overcome this</p>

Sathish Kumar
<p>No logs or no events shown when you run the describe command generally suggests that that there is an issue with invoking your entrypoint in your Dockerfile. So, you may have to overwrite the command  in your deployment.yaml</p>
<p>In your case - your deployment may need to use the command that you have or tried to use in your Dockerfile. Apparently, kubernetes pod is unable to use what you have defined in the Dockerfile.</p>
