<p>I have a problem with Kubernetes on my local machine. I want to create a pod with a database so I prepared a deployment file with service.</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: bid-service-db
  labels:
    app: bid-service-db
    tier: database
spec:
  ports:
  - name: &quot;5432&quot;
    port: 5432
    targetPort: 5432
  selector:
    app: bid-service-db
    tier: database

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: bid-service-db
  labels:
    app: bid-service-db
    tier: database
spec:
  selector:
    matchLabels:
      app: bid-service-db
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: bid-service-db
        tier: database
    spec:
      containers:
      - env:
        - name: POSTGRES_DB
          value: mydb
        - name: POSTGRES_PASSWORD
          value: password
        - name: POSTGRES_USER
          value: postgres
        image: postgres:13
        imagePullPolicy: Never
        name: bid-service-db
        ports:
        - containerPort: 5432
          name: bid-service-db
        resources: {}
      restartPolicy: Always
      serviceAccountName: &quot;&quot;
      volumes:
        - name: postgres-persistance-storage
          persistentVolumeClaim:
            claimName: bid-service-db-volume
status: {}

</code></pre>
<p>I am applying this file with <code>k apply -f bid-db-deployment.yaml</code>. <code>k get all</code> returns that only service was created, but pod not started. What can I do in this case? How to troubleshoot that?</p>

<p>if you didn't get any errors on the 'apply' you can get the failure reason by:</p>
<pre><code>kubectl describe deployment/DEPLOMENT_NAME
</code></pre>
<p>Also, you can take only the deployment part and put it in a separate YAML file and see if you get errors.</p>
