Deployment error while referring deployment yaml directly from remote URL

12/15/2021

I have a file uploaded in cloud storage and when I try to deploy the yaml using the url of file it always throws below error, tried with multiple files and even with sample nginx yaml. Also I tried adding the same file in github repo but it did not help either

kubectl apply -f https://github.com/saurabhumathe/jfrog-docker-repo-simple-example/blob/master/nginx.yaml -n testnginx error: error parsing https://github.com/saurabhumathe/jfrog-docker-repo-simple-example/blob/master/nginx.yaml: error converting YAML to JSON: yaml: line 148: mapping values are not allowed in this context

However, the same file works at below URL as given in k8s documentation.

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

Does anyone know what the issue is with using yaml URL to deploy artefacts with kubectl ?

-- saurabh umathe
kubectl
kubernetes
kubernetes-deployment

1 Answer

12/15/2021

You are getting HTTP document instead of the yaml spec. Try using the raw url, example kubectl apply -f https://raw.githubusercontent.com/saurabhumathe/jfrog-docker-repo-simple-example/master/nginx.yaml

-- gohm'c
Source: StackOverflow