<!--

Welcome to Apache Airflow!  For a smooth issue process, try to answer the following questions.
Don't worry if they're not all applicable; just try to include what you can :-)

If you need to include code snippets or logs, please put them in fenced code
blocks.  If they're super-long, please use the details tag like
<details><summary>super-long log</summary> lots of stuff </details>

Please delete these comment blocks before submitting the issue.

-->

<!--

IMPORTANT!!!

PLEASE CHECK "SIMILAR TO X EXISTING ISSUES" OPTION IF VISIBLE
NEXT TO "SUBMIT NEW ISSUE" BUTTON!!!

PLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!!

Please complete the next sections or the issue will be closed.
These questions are the first thing we need to know to understand the context.

-->

**Apache Airflow version**: 2.0.0


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

**Environment**:

- **Cloud provider or hardware configuration**: PC (docker-compose)
- **OS** (e.g. from /etc/os-release): Linux mint 20 (for PC), Debian Buster in container
- **Kernel** (e.g. `uname -a`): Linux 607a1bfeebd2 5.4.0-60-generic #67-Ubuntu SMP Tue Jan 5 18:31:36 UTC 2021 x86_64 GNU/Linux
- **Install tools**: Poetry (so pipy)
- **Others**:
Using python 3.8.6, with Celery Executor, one worker
Task did run properly

**What happened**:
I tried to get the logs of a task instance using the stable Rest API through the Swagger UI included in Airflow, and it crashed (got a stack trace)
I got 500 error
```
engine-webserver_1     | 2021-01-12T16:45:18.465370280Z [2021-01-12 16:45:18,464] {app.py:1891} ERROR - Exception on /api/v1/dags/insert/dagRuns/manual__2021-01-12T15:05:59.560500+00:00/taskInstances/insert-db/logs/0 [GET]
engine-webserver_1     | 2021-01-12T16:45:18.465391147Z Traceback (most recent call last):
engine-webserver_1     | 2021-01-12T16:45:18.465394643Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
engine-webserver_1     | 2021-01-12T16:45:18.465397709Z     response = self.full_dispatch_request()
engine-webserver_1     | 2021-01-12T16:45:18.465400161Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
engine-webserver_1     | 2021-01-12T16:45:18.465402912Z     rv = self.handle_user_exception(e)
engine-webserver_1     | 2021-01-12T16:45:18.465405405Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
engine-webserver_1     | 2021-01-12T16:45:18.465407715Z     reraise(exc_type, exc_value, tb)
engine-webserver_1     | 2021-01-12T16:45:18.465409739Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
engine-webserver_1     | 2021-01-12T16:45:18.465412258Z     raise value
engine-webserver_1     | 2021-01-12T16:45:18.465414560Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
engine-webserver_1     | 2021-01-12T16:45:18.465425555Z     rv = self.dispatch_request()
engine-webserver_1     | 2021-01-12T16:45:18.465427999Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
engine-webserver_1     | 2021-01-12T16:45:18.465429697Z     return self.view_functions[rule.endpoint](**req.view_args)
engine-webserver_1     | 2021-01-12T16:45:18.465431146Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/connexion/decorators/decorator.py", line 48, in wrapper
engine-webserver_1     | 2021-01-12T16:45:18.465433001Z     response = function(request)
engine-webserver_1     | 2021-01-12T16:45:18.465434308Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/connexion/decorators/uri_parsing.py", line 144, in wrapper
engine-webserver_1     | 2021-01-12T16:45:18.465435841Z     response = function(request)
engine-webserver_1     | 2021-01-12T16:45:18.465437122Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/connexion/decorators/validation.py", line 384, in wrapper
engine-webserver_1     | 2021-01-12T16:45:18.465438620Z     return function(request)
engine-webserver_1     | 2021-01-12T16:45:18.465440074Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/connexion/decorators/response.py", line 103, in wrapper
engine-webserver_1     | 2021-01-12T16:45:18.465441667Z     response = function(request)
engine-webserver_1     | 2021-01-12T16:45:18.465443086Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/connexion/decorators/parameter.py", line 121, in wrapper
engine-webserver_1     | 2021-01-12T16:45:18.465445345Z     return function(**kwargs)
engine-webserver_1     | 2021-01-12T16:45:18.465446713Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/airflow/api_connexion/security.py", line 47, in decorated
engine-webserver_1     | 2021-01-12T16:45:18.465448202Z     return func(*args, **kwargs)
engine-webserver_1     | 2021-01-12T16:45:18.465449538Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/airflow/utils/session.py", line 65, in wrapper
engine-webserver_1     | 2021-01-12T16:45:18.465451032Z     return func(*args, session=session, **kwargs)
engine-webserver_1     | 2021-01-12T16:45:18.465452504Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/airflow/api_connexion/endpoints/log_endpoint.py", line 81, in get_log
engine-webserver_1     | 2021-01-12T16:45:18.465454135Z     logs, metadata = task_log_reader.read_log_chunks(ti, task_try_number, metadata)
engine-webserver_1     | 2021-01-12T16:45:18.465455658Z   File "/brain/engine/.cache/poetry/meta-vSi4r4R8-py3.8/lib/python3.8/site-packages/airflow/utils/log/log_reader.py", line 58, in read_log_chunks
engine-webserver_1     | 2021-01-12T16:45:18.465457226Z     logs, metadatas = self.log_handler.read(ti, try_number, metadata=metadata)
engine-webserver_1     | 2021-01-12T16:45:18.465458632Z ValueError: not enough values to unpack (expected 2, got 1)
```

<!-- (please include exact error messages if you can) -->

**What you expected to happen**:
I expected to get the logs of my task
<!-- What do you think went wrong? -->

**How to reproduce it**:
I think it's everytime (at least on my side)

<!---

As minimally and precisely as possible. Keep in mind we do not have access to your cluster or dags.

If you are using kubernetes, please attempt to recreate the issue using minikube or kind.

## Install minikube/kind

- Minikube https://minikube.sigs.k8s.io/docs/start/
- Kind https://kind.sigs.k8s.io/docs/user/quick-start/

If this is a UI bug, please provide a screenshot of the bug or a link to a youtube video of the bug in action

You can include images using the .md style of
![alt text](http://url/to/img.png)

To record a screencast, mac users can use QuickTime and then create an unlisted youtube video with the resulting .mov file.

--->


**Anything else we need to know**:
Other stable API call, such as getting list of dags runs, task instance, etc worked well.
Logs is appearing well if I go to 
<!--

How often does this problem occur? Once? Every time etc?

Any relevant logs to include? Put them here in side a detail tag:


-->

EDIT : Ok, I'm stupid, I put 0 as try number, instead of 1...
So not a big bug, though I think 0 as try number should be a 400 status response, not 500 crash.
Should I keep it open ?
airflow/utils/log/file_task_handler.py
log += f"*** {str(e)}\n"
        elif conf.get('core', 'executor') == 'KubernetesExecutor':  
            try:
                from airflow.kubernetes.kube_client import get_kube_client
                kube_client = get_kube_client()
                if len(ti.hostname) >= 63:
                    
                    
                    
                    pod_list = kube_client.list_namespaced_pod(conf.get('kubernetes', 'namespace'))
                    matches = [
                        pod.metadata.name
                        for pod in pod_list.items
                        if pod.metadata.name.startswith(ti.hostname)
                    ]
                    if len(matches) == 1:
                        if len(matches[0]) > len(ti.hostname):
                            ti.hostname = matches[0]
                log += '*** Trying to get logs (last 100 lines) from worker pod {} ***\n\n'.format(
                    ti.hostname
                )
                res = kube_client.read_namespaced_pod_log(
                    name=ti.hostname,
                    namespace=conf.get('kubernetes', 'namespace'),
                    container='base',
                    follow=False,
                    tail_lines=100,
                    _preload_content=False,
                )
                for line in res: