1

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.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

2 Answers2

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.

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"
Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
  • The container is running in the Kubernetes cluster. How can I pass the path of my local folder(Example Documents) and let the container know that I want to mount this folder and I want all the downloaded files from the container in the Documents folder of my local machine? – Juhi Sehgal Sep 11 '21 at 12:33
  • Where is your Kubernetes cluster running ? In cloud or local ? – Harsh Manvar Sep 11 '21 at 12:37
  • You can not download but you can share & access local folder’s content into container so that local file will be accessible into container and vice sa versa. – Harsh Manvar Sep 11 '21 at 12:38
  • cluster is running in cloud – Juhi Sehgal Sep 11 '21 at 12:42
  • Won’t be possible to mount your local folder unless you are running K8s locally. You have to write api to upload files in S3 or else use hostpath SSH into node and access the folder on K8s node – Harsh Manvar Sep 11 '21 at 12:55
  • If you can RDP into windows instance and running Kubernetes there, i have shared yaml config example above please follow that. If you are on managed cloud like EKS, GKE I won’t be possible. Keep in mind your folder will be accessible on RDP instace, won’t be able to still mount your local folder to that K8s cluster. – Harsh Manvar Sep 11 '21 at 13:00
0

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)

Vish
  • 867
  • 6
  • 19
  • 45