error: one of src or dest must be a remote file specification

error: one of src or dest must be a remote file specification

我正在尝试通过以下命令将本地文件夹移动到 kubernetes 卷中:

kubectl cp /* mynamespace/mypod-xxxx-xxxx:/var/www/my-content

不幸的是,我收到以下错误消息:

error: one of src or dest must be a remote file specification

甚至我已经按如下方式配置卷挂载:

      volumeMounts:
        - mountPath: "/var/www/my-content"
          name: mycontent
  volumes:
    - name: mycontent
      persistentVolumeClaim:
        claimName: mypvc

请让我知道我遗漏了哪些配置信息。

* 中存在一个问题,目前 kubectl cp 不支持该问题。 要解决此问题,只需删除 * 并使用完整的目录名称,如

kubectl cp /folder_name/ mynamespace/mypod-xxxx-xxxx:/var/www/my-content

但在这种情况下,将创建一个文件夹,如 /var/www/my-content/folder_name。 您必须在代码中对此进行调整,或者您可以将本地文件夹名称命名为 my-content 并复制到 /var/www/.