Configuring Streamlit deployment parameters in Kubernetes

Hi all,

I am struggling to setup the proper configurations for streamlit to run in a deployed environment (I am quite new in the deployment step)

I have an app that works well locally =D and that I am trying to deploy it. The app itself is not really relevant since I can replicate the error with streamlit hello so I will try to explain the environment.

The app is deployed in a kubernetes argocd environment with a container based on a Dockerfile. The app pod serves at the port 8501, but an nginx server captures the ingress in port 80 from a

The environment itself is working and functions correctly with a hello world Flask app. That is if I access the in port 80 it redirects correctly to my flask app in port 8501.

Now the problems starts with my Streamlit app (the hello app). The docker file that creates the app is exactly like this from the docs
apart from the entrypoint that says:

ENTRYPOINT ["streamlit", "hello", "--server.port=8501", "--server.address="]

If I deploy like this, I get only the streamlit/index.html)

If I change my entrypoint to:

ENTRYPOINT ["streamlit", "hello", "--server.port=80", "--browser.serverAddress=", "--browser.serverPort=80"]

My pod crashes and I get the error:

2023-04-04 10:18:52.154 Serving static content from /usr/local/lib/python3.9/site-packages/streamlit/static
Traceback (most recent call last):
  File "/usr/local/bin/streamlit", line 8, in <module>
  File "/usr/local/lib/python3.9/site-packages/click/", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/", line 158, in main_hello
    _main_run(filename, flag_options=kwargs)
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/", line 242, in _main_run, command_line, args, flag_options)
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/", line 416, in run
  File "/usr/local/lib/python3.9/asyncio/", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/asyncio/", line 647, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/", line 404, in run_server
    await server.start()
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/server/", line 209, in start
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/server/", line 120, in start_listening
  File "/usr/local/lib/python3.9/site-packages/streamlit/web/server/", line 140, in start_listening_tcp_socket
    http_server.listen(port, address)
  File "/usr/local/lib/python3.9/site-packages/tornado/", line 183, in listen
    sockets = bind_sockets(
  File "/usr/local/lib/python3.9/site-packages/tornado/", line 162, in bind_sockets
PermissionError: [Errno 13] Permission denied

I have a feeling that it might just be a configuration issue with the ports and address, but it might be something else.
What is the difference of the browser port and the server port, and browser and server address fields?
The default values do not crash the app but the app doesn’t work either.

Does anyone have any tips on how to proceed here?

Thanks in advance,

1 Like