<p>I have the following project:</p>
<pre><code>database-migration/
    migration.yml
    kustomization.yml
</code></pre>
<p>Where <code>kustomization.yml</code> looks like:</p>
<pre><code>resources:
  - migration.yml
images:
  - name: enterprise-server
    newTag: 2020.12-6243
    newName: example/enterprise-server
configMapGenerator:
  - name: database-config
    literals:
      - ADMIN_REPOSITORY_URL=jdbc:postgresql://10.1.0.34:5432/app_db
      - AGENT_REPOSITORY_URL=jdbc:postgresql://10.1.0.34:5432/app_db
      - DB_CONNECTION_IDLE_TIMEOUT=60000
      - DB_CONNECTION_MAX_LIFETIME_TIMEOUT=120000
secretGenerator:
  - name: database-credentials
    literals:
      - ADMIN_REPOSITORY_USERNAME=app_admin
      - ADMIN_REPOSITORY_CONNECTION_USERNAME=app_admin@10.1.0.34
      - ADMIN_REPOSITORY_PASSWORD=12345
      - AGENT_REPOSITORY_USERNAME=app_agent
      - AGENT_REPOSITORY_CONNECTION_USERNAME=app_agent@10.1.0.34
      - AGENT_REPOSITORY_PASSWORD=23456
commonLabels:
  app.kubernetes.io/version: 2020.12-6243
  app.kubernetes.io/part-of: myapp
</code></pre>
<p>And where <code>migration.yml</code> looks like:</p>
<pre><code>apiVersion: batch/v1
kind: Job
metadata:
  name: database-migration
  labels:
    app.kubernetes.io/name: database-migration
    app.kubernetes.io/component: database-migration
spec:
  template:
    metadata:
      labels:
        app.kubernetes.io/name: database-migration
        app.kubernetes.io/component: database-migration
    spec:
      containers:
        - name: database-migration
          image: enterprise-server
          env:
            - name: CLOUD_ENVIRONMENT
              value: KUBERNETES
          envFrom:
            - configMapRef:
                name: database-config
            - secretRef:
                name: database-credentials
          command: ['sh', '-c', '/usr/local/app_enterprise/bin/databaseMigration || [ $? -eq 15 ]; exit $?']
      restartPolicy: Never
</code></pre>
<p>When I run:</p>
<pre><code>kubectl create ns appdb
kubectl -n appdb apply -k database-migration
kubectl -n appdb wait --for=condition=complete --timeout=10m job/database-migration
</code></pre>
<p>It just hangs for 10 minutes and then fails:</p>
<pre><code>error: timed out waiting for the condition on jobs/database-migration
</code></pre>
<p>I'd like to tail logs or just look at logs (even after the fact) but not sure how to get logs for a job that has failed, or how to tail logs for an ongoing job. <strong>Any ideas?</strong></p>

hotmeatballsoup
<p>A Job creates pods for execution. You can just check the pods (or all elements)</p>
<p><code>kubectl -n appdb get all</code></p>
<p>and then request the logs for the pod, for example</p>
<p><code>kubectl -n appdb logs -f database-migration-xyz123</code></p>
