直接从远程引用部署 yaml 时出现部署错误 URL

Deployment error while referring deployment yaml directly from remote URL

我在云存储中上传了一个文件,当我尝试使用文件的 url 部署 yaml 时,它总是抛出以下错误,尝试使用多个文件,甚至使用示例 nginx yaml。我也尝试在 github 回购中添加相同的文件,但它也没有帮助

kubectl apply -f https://github.com/saurabhumathe/jfrog-docker-repo-simple-example/blob/master/nginx.yaml -n testnginx 错误:解析错误 https://github.com/saurabhumathe/jfrog-docker-repo-simple-example/blob/master/nginx.yaml:将 YAML 转换为 JSON 时出错:yaml:第 148 行:此上下文中不允许映射值

但是,与 k8s 文档中给出的相同文件在 URL 以下工作。

https://k8s.io/examples/controllers/nginx-deployment.yaml

有人知道使用 yaml URL 通过 kubectl 部署人工制品有什么问题吗?

您正在获取 HTTP 文档而不是 yaml 规范。尝试使用原始 url,示例 kubectl apply -f https://raw.githubusercontent.com/saurabhumathe/jfrog-docker-repo-simple-example/master/nginx.yaml