<p>I am new to Kubernetes.</p>
<p>Following is the yaml I am running:</p>
<pre><code>---
apiVersion: v1
kind: Service
metadata:
  labels:
    app.kubernetes.io/name: k8-demo-aishwarya
    app.kubernetes.io/version: version1
  name: k8-demo-aishwarya
spec:
  ports:
  - name: http
    port: 80
    targetPort: 80
  selector:
    app.kubernetes.io/name: k8-demo-aishwarya
    app.kubernetes.io/version: version1
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: k8-demo-aishwarya
    app.kubernetes.io/version: version1
  name: k8-demo-aishwarya
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: k8-demo-aishwarya
      app.kubernetes.io/version: version1
  template:
    metadata:
      labels:
        app.kubernetes.io/name: k8-demo-aishwarya
        app.kubernetes.io/version: version1
    spec:
      containers:
      - env:
        - name: KUBERNETES_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        image: docker.io/aishvaryaps/spring-boot-on-kubernetes-example:0.12-SNAPSHOT
        imagePullPolicy: IfNotPresent
        name: k8-demo-aishwarya
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
</code></pre>
<hr />
<p>Getting a crashloopbackoff error</p>
<p>Can anyone guide me?</p>
<p>No issue with the image, it runs properly, I have tested that on Docker.</p>
<p><strong>Kubernetes pod logs are as follows</strong>:</p>
<pre><code>1. Successfully assigned default/k8-demo-aishwarya-fdd8d58c6-lvxp9 to gke-cluster-3-pool-1-997819b9-j3b2
2. Container image &quot;docker.io/aishvaryaps/spring-boot-on-kubernetes-example:0.12-SNAPSHOT&quot; already present on machine
3. Created container k8-demo-aishwarya
4. Started container k8-demo-aishwarya
5. Back-off restarting failed container
</code></pre>

Aishvarya Suryawanshi
<p>Please check the logs of POD for more details however i think it's due to processing is ending inside container and printing <code>Hello World by Aishwarya S!</code> you can check same by logs.</p>
<p>You can keep running pod by adding line in your YAML :</p>
<pre><code>command: [&quot;/bin/sh&quot;, &quot;-ec&quot;, &quot;sleep 1000&quot;]
</code></pre>
<p>This command keep pod running</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/name: k8-demo-aishwarya
    app.kubernetes.io/version: version1
  name: k8-demo-aishwarya
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: k8-demo-aishwarya
      app.kubernetes.io/version: version1
  template:
    metadata:
      labels:
        app.kubernetes.io/name: k8-demo-aishwarya
        app.kubernetes.io/version: version1
    spec:
      containers:
      - env:
        - name: KUBERNETES_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        image: docker.io/aishvaryaps/spring-boot-on-kubernetes-example:0.12-SNAPSHOT
        command: [&quot;/bin/sh&quot;, &quot;-ec&quot;, &quot;sleep 1000&quot;]
        imagePullPolicy: IfNotPresent
        name: k8-demo-aishwarya
        ports:
        - containerPort: 80
          name: http
          protocol: TCP
</code></pre>
