You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
9090 Port-forwarded not accessible from inside container on --network="host":
To reproduce we will port-forward the promethues using kubectl port-forward svc/prometheus-stack-kube-prom-prometheus 9090:9090 -n monitoring then build and run the devtool container:
On running sli.robot and we can see it's not able to connect to localhost!
➜ ifc-rw-codecollection git:(fix/rds) docker exec rds-codecollection bash -c "ro /app/codecollection/codebundles/rds-mysql-conn-count/sli.robot && ls -R /robot_logs"
==============================================================================
Sli :: Run a PromQL query against Prometheus instant query API, perform a p...
==============================================================================
Querying Prometheus Instance And Pushing Aggregated Data | FAIL |
ValueError: Recieved return code of 7 from response ShellServiceResponse(cmd='eval $(echo "curl -X GET \'http://localhost:9090/api/v1/query?query=aws_rds_database_connections_average%7Bdimension_DBInstanceIdentifier%3D%22robotshopmysql%22%7D%20%3E%201&time=2024-02-05T10%3A44%3A24.699464Z&step=30\'")', parsed_cmd=['rbash', '-c', 'eval $(echo "curl -X GET \'http://localhost:9090/api/v1/query?query=aws_rds_database_connections_average%7Bdimension_DBInstanceIdentifier%3D%22robotshopmysql%22%7D%20%3E%201&time=2024-02-05T10%3A44%3A24.699464Z&step=30\'")'], stdout='', stderr=' % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\n 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to localhost port 9090: Connection refused\n', returncode=7, status=200, body='', errors=[])
checked with bare curl
To confirm that our port-forwarded promethues is reachable from inside the container we will run curl from inside container using above query which failed and we can see it succeeded.
SLI K8s deployment not able to resolve internal dns:
Running devtool container inside k8s so that we can access the PROMETHEUS_URL using internal endpoint http://prometheus-stack-kube-prom-prometheus.monitoring.svc.cluster.local:9090,
After deployment we run kubectl exec deploy/rds-mysql-connection-count-sli -n runwhen -- ro /app/codecollection/codebundles/rds-mysql-conn-count/sli.robot which gives Could not resolve host error
Querying Prometheus Instance And Pushing Aggregated Data | FAIL |
ValueError: Recieved return code of 6 from response ShellServiceResponse(cmd='eval $(echo "curl -X GET \'http://prometheus-stack-kube-prom-prometheus.monitoring.svc.cluster.local:9090/api/v1/query?query=aws_rds_database_connections_average%7Bdimension_DBInstanceIdentifier%3D%22robotshopmysql%22%7D%20%3E%201&time=2024-02-05T11%3A42%3A00.169554Z&step=30\'")', parsed_cmd=['rbash', '-c', 'eval $(echo "curl -X GET \'http://prometheus-stack-kube-prom-prometheus.monitoring.svc.cluster.local:9090/api/v1/query?query=aws_rds_database_connections_average%7Bdimension_DBInstanceIdentifier%3D%22robotshopmysql%22%7D%20%3E%201&time=2024-02-05T11%3A42%3A00.169554Z&step=30\'")'], stdout='', stderr=' % Total % Received % Xferd Average Speed Time Time Time Current\n Dload Upload Total Spent Left Speed\n\n 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\n 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (6) Could not resolve host: prometheus-stack-kube-prom-prometheus.monitoring.svc.cluster.local\n', returncode=6, status=200, body='', errors=[])
checked with bare curl
exec inside pod and run the same failing query again with curl this time which seems working
Issue
9090 Port-forwarded not accessible from inside container on
--network="host"
:To reproduce we will port-forward the promethues using
kubectl port-forward svc/prometheus-stack-kube-prom-prometheus 9090:9090 -n monitoring
then build and run the devtool container:On running sli.robot and we can see it's not able to connect to localhost!
checked with bare curl
To confirm that our port-forwarded promethues is reachable from inside the container we will run curl from inside container using above query which failed and we can see it succeeded.
checked with rbash eval
so we thought may be there will be issue with rbash eval so to confirm let's try above query with rbash eval. This also works.
SLI K8s deployment not able to resolve internal dns:
Running devtool container inside k8s so that we can access the
PROMETHEUS_URL
using internal endpointhttp://prometheus-stack-kube-prom-prometheus.monitoring.svc.cluster.local:9090
,Note change url in sli-deployment.yaml
After deployment we run
kubectl exec deploy/rds-mysql-connection-count-sli -n runwhen -- ro /app/codecollection/codebundles/rds-mysql-conn-count/sli.robot
which givesCould not resolve host
errorchecked with bare curl
exec inside pod and run the same failing query again with curl this time which seems working
checked with rbash eval
check if the port is open on
prometheus-stack-kube-prom-prometheus.monitoring.svc.cluster.local
from inside pod using netcat utilCheck the
/etc/resolv.conf
The text was updated successfully, but these errors were encountered: