question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

KubernetesPodOperator does not have any logs

See original GitHub issue

Apache Airflow version: 2.0.2

Kubernetes version (if you are using kubernetes) (use kubectl version):

...
Server Version: version.Info{Major:"1", Minor:"18+", GitVersion:"v1.18.9-eks-d1db3c", GitCommit:"d1db3c46e55f95d6a7d3e5578689371318f95ff9", GitTreeState:"clean", BuildDate:"2020-10-20T22:18:07Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}

Environment:

  • Cloud provider or hardware configuration: AWS
  • OS (e.g. from /etc/os-release): linux
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

What happened:

With DEBUG logging on, when using a simple hello world KubernetesPodOperator no logs are produced in the executor either when there is a problem with the setup or when everything is working.

What you expected to happen: Executor has logs showing the error or successful invocation.

There are no logs at all. If I force it to be interactive by changing https://github.com/apache/airflow/blob/476d0f6e3d2059f56532cda36cdc51aa86bafb37/airflow/cli/commands/task_command.py#L236 (comment out the with clause and just invoke _run_task_by_selected_method as is done for interactive) I get logs in the executor pod. Whatever _capture_task_logs is trying to do it seems to hinder rather than help

How to reproduce it: With helm chart version 8.1.1 and airflow 2.0.2 built from source, and logging config:

[logging]
    colored_console_log = False
    logging_level = DEBUG
    remote_logging = False
    donot_modify_handlers = True

run a DAG that uses the from airflow.providers.cncf.kubernetes.operators.kubernetes_pod import KubernetesPodOperator operator. Note that there is no logging in the executor. Modify task_command.py to call _run_task_by_selected_method without try _capture_task_logs and see that the operator has a lot of useful logging including the pod spec (which is pretty much essential to diagnose any issues).

Anything else we need to know:

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
vbarbaresicommented, Aug 19, 2021

We are affected by this issue as well slaupster’s hack to remove _capture_task_logs() worked around the problem. It makes sense for us to use stdout/stderr for all tasks logs instead of writing them in a bucket: we collect all our infrastructure logs this way

0reactions
github-actions[bot]commented, Nov 2, 2022

This issue has been closed because it has not received response from the issue author.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Task launch information logged, but not stdout from container ...
I can access this information if I set the KubernetesPodOperator to leave the pod and then I can do a kubectl logs from...
Read more >
Getting logs using KubernetesPodOperator - Astronomer Forum
I keep getting an error when the task attempts to get the pod logs *** Log file does not exist: /usr/local/airflow/logs/refresh_pmt_c…
Read more >
Use the KubernetesPodOperator | Cloud Composer
The logs show this task is failing because the appropriate variable does not exist ( my_value ). The second error, which you can...
Read more >
Kubernetes Pod Logging in the Airflow UI | by Alexa Griffith
The worker logs are helpful to have, but a Kubernetes instance could be ... will obviously be a little frustrated because they have...
Read more >
apache-airflow-providers-cncf-kubernetes Documentation
Generally speaking if you did not subclass KubernetesPodOperator and you ... you have subclassed KubernetesPodOperator , what follows are some notes on the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found