Search code examples
kuberneteskubectl

kubectl - How to create resource(s) from url with basic auth


As stated in https://kubernetes.io/docs/reference/kubectl/cheatsheet/#creating-objects we can create resource(s) from url using kubectl.

example :

kubectl apply -f https://git.io/vPieo          # create resource(s) from url

What if the url have basic auth ?

Can we achieve this by using curl or wget ? I have tried below example but failed

kubectl apply -f $(curl -u 'user:pass' https://git.io/vPieo)      

Solution

  • Okay i solved it..

    curl -s -u 'user:pass' https://git.io/vPieo.yaml | kubectl get -f -