blabla1337 / skf-flask

Security Knowledge Framework (SKF) Python Flask / Angular project
https://www.securityknowledgeframework.org
Apache License 2.0
807 stars 308 forks source link

502 error at the end of the installation on Azure + Kubernetes #761

Open DylanGrl opened 2 years ago

DylanGrl commented 2 years ago

Hello,

I am having a 502 Bad Gateway error when doing API call to establish the first connection with the application.

The web app is displayed but any call to /api leads to a 502 error.

I have follow the Azure documentation provided and faced no issue during the process.

Does it happend to some one else ?

Is there an idea of a potential issue / resolution ?

github-actions[bot] commented 2 years ago

Thank you for creating an issue ticket for our SKF project, we highly appriciate the feedback so we can improve the project and make it more awesome for everyone! We will shortly come back to you after the evaluation of the issue.

JOT85 commented 2 years ago

What's the output of kubectl get pods like? Are all the pods running?

blabla1337 commented 2 years ago

So for the 502 error it could be that the step was not done

- LABS_KUBE_CONF=base64_string_here_of_the_content_of_the .kube/config file_for_example: cat ~/.kube/config | base64

if the LABS_KUBE_CONF is not set or not correct you also might get this error message

But indeed please provide some output of the kubectl get pods and could you maybe run the kubectl logs cmd on the skf-back pod? kubectl logs skf-flask-back-5b46949c57-6hfjc like this only replace the skf-flask-back-sadasdads with your own pod name

DylanGrl commented 2 years ago

The base64 is properly set inside the configuration.

Here is the list of pods :

NAME                                        READY   STATUS    RESTARTS   AGE
ingress-nginx-controller-6dc9476ccf-wlgjp   1/1     Running   0          19m
mysql-544f9cc4b8-h2m7x                      1/1     Running   0          30m
rabbitmq-dc6c69fdb-49j69                    1/1     Running   0          30m
skf-flask-back-7485ccf49f-ghhdx             1/1     Running   0          19m
skf-flask-front-6655945dbb-k5rgs            1/1     Running   0          19m

Regarding the logs :

Here are the logs from the DB :

2022-02-11 16:05:47 0 [Note] InnoDB: Waiting for purge to start
2022-02-11 16:05:47 0 [Note] InnoDB: 10.4.13 started; log sequence number 61452; transaction id 21
2022-02-11 16:05:47 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2022-02-11 16:05:47 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-02-11 16:05:47 0 [Note] InnoDB: Buffer pool(s) load completed at 220211 16:05:47
2022-02-11 16:05:47 0 [Note] Server socket created on IP: '::'.
2022-02-11 16:05:47 0 [Warning] 'user' entry '@mysql-544f9cc4b8-h2m7x' ignored in --skip-name-resolve mode.
2022-02-11 16:05:47 0 [Warning] 'proxies_priv' entry '@% root@mysql-544f9cc4b8-h2m7x' ignored in --skip-name-resolve mode.
2022-02-11 16:05:47 0 [Note] Reading of all Master_info entries succeeded
2022-02-11 16:05:47 0 [Note] Added new Master_info '' to hash table
2022-02-11 16:05:47 0 [Note] /usr/bin/mysqld: ready for connections.
Version: '10.4.13-MariaDB'  socket: '/run/mysqld/mysqld.sock'  port: 3306  MariaDB Server
2022-02-11 16:06:55 8 [Warning] Aborted connection 8 to db: 'skf' user: 'root' host: 'X.X.X.X' (Got an error reading communication packets)
2022-02-11 16:17:47 9 [Warning] Aborted connection 9 to db: 'skf' user: 'root' host: 'X.X.X.X' (Got an error reading communication packets)

The backend :

2022-02-11 16:17:47,626 - skf.db_tools - INFO - Initializing the database
2022-02-11 16:17:47,808 - skf.db_tools - INFO - Database is already existsing, nothing to do
2022-02-11 16:17:47,808 - user_api.skf.app - INFO - Created the database.
+ /home/user_api/.local/bin/gunicorn --bind 0.0.0.0:8888 --workers=6 --threads=3 wsgi:app
[2022-02-11 16:17:48 +0000] [27] [INFO] Starting gunicorn 20.0.4
[2022-02-11 16:17:48 +0000] [27] [INFO] Listening at: http://0.0.0.0:8888 (27)
[2022-02-11 16:17:48 +0000] [27] [INFO] Using worker: threads
[2022-02-11 16:17:48 +0000] [30] [INFO] Booting worker with pid: 30
[2022-02-11 16:17:48 +0000] [31] [INFO] Booting worker with pid: 31
[2022-02-11 16:17:48 +0000] [32] [INFO] Booting worker with pid: 32
[2022-02-11 16:17:48 +0000] [33] [INFO] Booting worker with pid: 33
[2022-02-11 16:17:48 +0000] [34] [INFO] Booting worker with pid: 34
[2022-02-11 16:17:48 +0000] [35] [INFO] Booting worker with pid: 35
RiieCco commented 2 years ago

@DylanGrl, were you able to fix it in the mean time?

cptfixit commented 1 year ago

It's over a year later, let's close this case.