kubectl - 如何使用基本身份验证从 url 创建资源

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

https://kubernetes.io/docs/reference/kubectl/cheatsheet/#creating-objects 中所述,我们可以使用 kubectl 从 url 创建资源。

示例:

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

如果 url 有基本授权怎么办?

我们可以使用 curl 或 wget 来实现吗?我试过下面的例子但失败了

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

好的我解决了..

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