Reputation: 89
A Windows aks node creates a file within the node and writes logs on it. I would like to make a theaks node/pod to write a file on a local host, and the local host to be able to read it. How can I do this? Can I copy a file on an aks node to the local host via Dockerfile? or should I do this by persistent volume? Any help is appreciated!
Upvotes: 0
Views: 1199
Reputation: 158848
In general, the set of places that code in Kubernetes can write to is fairly limited. It can directly write to filesystems, but only those it manages itself. It can have access to network-accessible systems and make calls to cloud-hosted APIs, but not necessarily to directly write to those systems.
Code running in Kubernetes can't write back to your local desktop system. There's not a network service running that it can reach, and something running in the cloud generally can't access your local disk at all.
If you can arrange for your application to be network-transaction-oriented rather than file-oriented, that's the best way to handle this. My Stack Overflow answer isn't arriving on your local desktop system, for example, you need to make another HTTP request to the Stack Overflow site to retrieve it. You could replicate this same basic pattern to make an HTTP request to your Kubernetes-hosted service to start some unit of work, and then another HTTP request to retrieve its result (if it's ready).
If your application has to remain file-oriented, another approach might be to set up some sort of cloud storage. Give the Kubernetes code permission to write to that cloud storage bucket, and make sure your user has permission to read it. (Azure Cloud Storage might work for you if the application is in AKS.) Start the job via whatever path, and then read back the result from the cloud storage when it's done.
Upvotes: 1