gpt4 book ai didi

kubernetes - 如何使用 kubectl 查看失败作业的日志?

转载 作者:行者123 更新时间:2023-12-04 10:13:59 25 4
gpt4 key购买 nike

我创建了一个现在失败的 Kubernetes 作业。我在哪里可以找到这份工作的日志?

我不确定如何找到关联的 pod(我假设一旦作业失败它会删除 pod)?

运行 kubectl describe job 似乎没有显示任何相关信息:

Name:           app-raiden-migration-12-19-58-21-11-2018
Namespace: localdev
Selector: controller-uid=c2fd06be-ed87-11e8-8782-080027eeb8a0
Labels: jobType=database-migration
Annotations: kubectl.kubernetes.io/last-applied-configuration={"apiVersion":"batch/v1","kind":"Job","metadata":{"annotations":{},"labels":{"jobType":"database-migration"},"name":"app-raiden-migration-12-19-58-21-1...
Parallelism: 1
Completions: 1
Start Time: Wed, 21 Nov 2018 12:19:58 +0000
Pods Statuses: 0 Running / 0 Succeeded / 1 Failed
Pod Template:
Labels: controller-uid=c2fd06be-ed87-11e8-8782-080027eeb8a0
job-name=app-raiden-migration-12-19-58-21-11-2018
Containers:
app:
Image: pp3-raiden-app:latest
Port: <none>
Command:
php
artisan
migrate
Environment:
DB_HOST: local-mysql
DB_PORT: 3306
DB_DATABASE: raiden
DB_USERNAME: <set to the key 'username' in secret 'cloudsql-db-credentials'> Optional: false
DB_PASSWORD: <set to the key 'password' in secret 'cloudsql-db-credentials'> Optional: false
LOG_CHANNEL: stderr
APP_NAME: Laravel
APP_KEY: ABCDEF123ERD456EABCDEF123ERD456E
APP_URL: http://192.168.99.100
OAUTH_PRIVATE: <set to the key 'oauth_private.key' in secret 'laravel-oauth'> Optional: false
OAUTH_PUBLIC: <set to the key 'oauth_public.key' in secret 'laravel-oauth'> Optional: false
Mounts: <none>
Volumes: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SuccessfulCreate 2m job-controller Created pod: app-raiden-migration-12-19-58-21-11-2018-pwnjn
Warning BackoffLimitExceeded 2m job-controller Job has reach the specified backoff limit

最佳答案

另一种方法:

  • kubectl describe job $JOB
  • Pod 名称显示在“事件”下
  • kubectl logs $POD
  • 关于kubernetes - 如何使用 kubectl 查看失败作业的日志?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53411958/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com