How to copy files from kubernetes Pods to local system

后端 未结 10 1488
暖寄归人
暖寄归人 2020-12-24 10:22

I\'m trying to copy files from Kubernetes Pods to my local system. I am getting the below error while running following command:

kubectl cp aks-ssh2-6cd4948         


        
10条回答
  •  囚心锁ツ
    2020-12-24 11:17

    You can mount a local directory into the pod.

    Update your aks-ssh yaml file:

    spec:
      ...
      containers:
        ...
        volumeMounts:
        - name: test-dir
          mountPath: /home/azureuser
        ...
      volumes:
      - name: test-dir
        hostPath:
          path: /path/to/your/local/dir
    

    Now you can access your files in the local directory.

提交回复
热议问题