William Ross
William Ross

Reputation: 3910

Kubernetes determining default pod path for file write

I am looking to write to a file on a Kubernetes pod through Elixir code. The pod starts off when exec'ing in at /opt/app and I want to write a file to some path like /opt/app/file_tmp.

Currently I am hard coding in the file writing the string "/opt/app/" and was wondering if there is a better way to get the Kubernetes home directory so I don't need to hard code this string within the application?

Is there something env variable I can use like K8S_HOME or similar?

Upvotes: 0

Views: 1849

Answers (1)

Jonas
Jonas

Reputation: 128807

wondering if there is a better way to get the Kubernetes home directory so I don't need to hard code this string within the application?

Kubernetes is the container orchestrator. Your app runs in a container with its filesystem. You set the "working directory" in your Dockerfile with WORKDIR.

Upvotes: 2

Related Questions