Juhi Sehgal
Juhi Sehgal

Reputation: 25

How to access downloaded files in Kubernetes container

I am running my script inside a Kubernetes container and a zip file is downloaded.

  1. I want to verify how can I access the content inside a zip file when I am triggering tests from a windows machine and the tests are running inside the Kubernetes container through automation.

  2. How can I do mapping of the Kubernetes downloads folder so that I can access it as a windows folder on my local machine even after the testcase execution is completed.

Upvotes: 1

Views: 2604

Answers (2)

Harsh Manvar
Harsh Manvar

Reputation: 30160

I want to verify how can I access the content inside a zip file when I am triggering tests from a windows machine and the tests are running inside the Kubernetes container through automation.

If it's possible for you to write API uploading the zip file to storage you can do that also. Like S3 AWS or any other storage and access file from there, which may cost some extra if zip files are large.

There is also other option to save data in Disk Persitenet volume, if you are running managed services GKE, EKS you wont be able to access that data directly to local PC.

If you are running locally on windows PC you can mount the folder to POD and access created zip to local system.

How can I do mapping of the Kubernetes downloads folder so that I can access it as a windows folder on my local machine even after the testcase execution is completed.

You can use hostpath Volume type in your pod spec to mount a file or directory from the host node’s filesystem.

POD example :

apiVersion: v1
kind: Pod
metadata:
  name: hostpath-volume-pod
spec:
  containers:
  - name: my-hostpath-volume-pod
    image: <Image name>
    volumeMounts:
    - name: foo
      mountPath: "C:\\etc\\foo"
      readOnly: true
  volumes:
  - name: foo
    hostPath:
     path: "C:\\etc\\foo"

Upvotes: 1

Vish
Vish

Reputation: 879

you will need to attach persistent volume with the pods.

Concept https://kubernetes.io/docs/concepts/storage/persistent-volumes/

This link provide options if you are using docker desktop. Kubernetes persistent volume on Docker Desktop (Windows)

Upvotes: 0

Related Questions