How to view logs of failed jobs with kubectl?
I've created a Kubernetes job that has now failed. Where can I find the logs to this job?
I'm not sure how to find the associated pod (I assume once the job fails it deletes the pod)?
Running kubectl describe job
does not seem to show any relevant information:
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
kubernetes kubectl
add a comment |
I've created a Kubernetes job that has now failed. Where can I find the logs to this job?
I'm not sure how to find the associated pod (I assume once the job fails it deletes the pod)?
Running kubectl describe job
does not seem to show any relevant information:
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
kubernetes kubectl
It seems your pod hasn't started yet. It's failing to start.
– Shudipta Sharma
Nov 21 '18 at 13:07
add a comment |
I've created a Kubernetes job that has now failed. Where can I find the logs to this job?
I'm not sure how to find the associated pod (I assume once the job fails it deletes the pod)?
Running kubectl describe job
does not seem to show any relevant information:
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
kubernetes kubectl
I've created a Kubernetes job that has now failed. Where can I find the logs to this job?
I'm not sure how to find the associated pod (I assume once the job fails it deletes the pod)?
Running kubectl describe job
does not seem to show any relevant information:
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
kubernetes kubectl
kubernetes kubectl
asked Nov 21 '18 at 12:23
Chris Stryczynski
3,74252961
3,74252961
It seems your pod hasn't started yet. It's failing to start.
– Shudipta Sharma
Nov 21 '18 at 13:07
add a comment |
It seems your pod hasn't started yet. It's failing to start.
– Shudipta Sharma
Nov 21 '18 at 13:07
It seems your pod hasn't started yet. It's failing to start.
– Shudipta Sharma
Nov 21 '18 at 13:07
It seems your pod hasn't started yet. It's failing to start.
– Shudipta Sharma
Nov 21 '18 at 13:07
add a comment |
2 Answers
2
active
oldest
votes
kubectl get pods -a
And then a pod will be shown like below:
app-raiden-migration-12-19-58-21-11-2018-pwnjn 0/1 Error 0 6m
add a comment |
You can get the pods of this job by running:
kubectl get pods --selector=job-name=app-raiden-migration-12-19-58-21-11-2018
but in this case i think you won't find any pods because no pod is created, and as mentioned in this link: Job Termination and Cleanup, pods are not deleted after jobs completion.
But still i don't know how you can find out why that pod failed to run (but if there is a pod and you could find it, you can find the logs of that pod). I had the same mistake and i ran the job again and job worked successfully.
EDIT:
I just see the events of your job, your job has made pod and you can see the logs of your pod by your pod name as I mentioned above.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411958%2fhow-to-view-logs-of-failed-jobs-with-kubectl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
kubectl get pods -a
And then a pod will be shown like below:
app-raiden-migration-12-19-58-21-11-2018-pwnjn 0/1 Error 0 6m
add a comment |
kubectl get pods -a
And then a pod will be shown like below:
app-raiden-migration-12-19-58-21-11-2018-pwnjn 0/1 Error 0 6m
add a comment |
kubectl get pods -a
And then a pod will be shown like below:
app-raiden-migration-12-19-58-21-11-2018-pwnjn 0/1 Error 0 6m
kubectl get pods -a
And then a pod will be shown like below:
app-raiden-migration-12-19-58-21-11-2018-pwnjn 0/1 Error 0 6m
answered Nov 21 '18 at 12:27
Chris Stryczynski
3,74252961
3,74252961
add a comment |
add a comment |
You can get the pods of this job by running:
kubectl get pods --selector=job-name=app-raiden-migration-12-19-58-21-11-2018
but in this case i think you won't find any pods because no pod is created, and as mentioned in this link: Job Termination and Cleanup, pods are not deleted after jobs completion.
But still i don't know how you can find out why that pod failed to run (but if there is a pod and you could find it, you can find the logs of that pod). I had the same mistake and i ran the job again and job worked successfully.
EDIT:
I just see the events of your job, your job has made pod and you can see the logs of your pod by your pod name as I mentioned above.
add a comment |
You can get the pods of this job by running:
kubectl get pods --selector=job-name=app-raiden-migration-12-19-58-21-11-2018
but in this case i think you won't find any pods because no pod is created, and as mentioned in this link: Job Termination and Cleanup, pods are not deleted after jobs completion.
But still i don't know how you can find out why that pod failed to run (but if there is a pod and you could find it, you can find the logs of that pod). I had the same mistake and i ran the job again and job worked successfully.
EDIT:
I just see the events of your job, your job has made pod and you can see the logs of your pod by your pod name as I mentioned above.
add a comment |
You can get the pods of this job by running:
kubectl get pods --selector=job-name=app-raiden-migration-12-19-58-21-11-2018
but in this case i think you won't find any pods because no pod is created, and as mentioned in this link: Job Termination and Cleanup, pods are not deleted after jobs completion.
But still i don't know how you can find out why that pod failed to run (but if there is a pod and you could find it, you can find the logs of that pod). I had the same mistake and i ran the job again and job worked successfully.
EDIT:
I just see the events of your job, your job has made pod and you can see the logs of your pod by your pod name as I mentioned above.
You can get the pods of this job by running:
kubectl get pods --selector=job-name=app-raiden-migration-12-19-58-21-11-2018
but in this case i think you won't find any pods because no pod is created, and as mentioned in this link: Job Termination and Cleanup, pods are not deleted after jobs completion.
But still i don't know how you can find out why that pod failed to run (but if there is a pod and you could find it, you can find the logs of that pod). I had the same mistake and i ran the job again and job worked successfully.
EDIT:
I just see the events of your job, your job has made pod and you can see the logs of your pod by your pod name as I mentioned above.
edited Dec 30 '18 at 11:52
answered Dec 30 '18 at 11:10
mahdi1008
13
13
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411958%2fhow-to-view-logs-of-failed-jobs-with-kubectl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It seems your pod hasn't started yet. It's failing to start.
– Shudipta Sharma
Nov 21 '18 at 13:07