-1

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
  • 315
  • 2
  • 17

1 Answers1

1

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
  • 13,492
  • 1
  • 9
  • 16
  • Thank you @gohm''c, yes it is working with raw url. One question, how can I get the same raw url for the file uploaded to cloud storage. any idea ? – saurabh umathe Dec 15 '21 at 07:56
  • It depends on how your cloud storage return text content. Example for aws s3 you can do: `aws s3 cp s3://mybucket/myspec.yaml --quiet - | kubectl apply -f -` – gohm'c Dec 15 '21 at 08:05
  • yes I have GCP store so gsutil command working for me. Thanks again for your help. – saurabh umathe Dec 15 '21 at 08:15