While I try to add docker desktop kubernetes to rancher cluster it shows error in curl command which they provided in adding cluster in rancher - kubernetes

curl --insecure -sfL https://104.211.32.151:8443/v3/import/zp2b5dhb7h79fn7qlk2g7k4rl2mv7b2j29s8brxfzmhskfnt4tvpmd.yaml | kubectl apply -f -
Invoke-WebRequest : A parameter cannot be found that matches parameter name 'sfL'.
At line:1 char:17
+ curl --insecure -sfL https://104.211.32.151:8443/v3/import/zp2b5dhb7h ...
+ ~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

It depends on your shell.
I usually use c:\Program files\Git\mingw64\bin\curl.exe (shipped with Git for windows) or C:\Windows\System32\curl.exe (with Windows 10), in a regular CMD shell session.
But if you are using a Powershell, as explained here, curl is a built in alias to Invoke-WebRequest cmdlet.
Use curl.exe instead of curl.

Related

Minikube on Windows 11 gives error on alias kubectl="minikube kubectl --"

I am following the tutorial for installing Minikube on Windows at:
https://minikube.sigs.k8s.io/docs/start/
It says that I should make a alias, however when I do this I get a error:
alias kubectl="minikube kubectl --"
Gives error:
alias : This command cannot find a matching alias because an alias with the name 'kubectl=minikube kubectl --' does not
exist.
At line:1 char:1
+ alias kubectl="minikube kubectl --"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (kubectl=minikube kubectl --:String) [Get-Alias], ItemNotFoundException
+ FullyQualifiedErrorId : ItemNotFoundException,Microsoft.PowerShell.Commands.GetAliasCommand

Windows cmdlet over powershell passes but gives access denied over winrm for Cluster aware updating

I am executing Invoke-CACURun for windows cluster aware updating on domain controller as an administrator. While that works on powershell, it is failing over ansible with ntlm transport and same credentials.
The command executed
ansible domain_controller -i ansible_hosts -m win_shell -a 'whoami;Invoke-CauRun -ClusterName "xyzWFC
The error I get is
Invoke-CauRun : Could not open cluster "xyzWFC": (Win32Exception) Access is denied
At line:1 char:72
+ ... .UTF8Encoding $false; whoami;Invoke-CauRun -ClusterName "xyzWFC";
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (:) [Invoke-CauRun], CauAccessDeniedException
+ FullyQualifiedErrorId : OpenClusterAccessDenied,Microsoft.ClusterAwareUpdating.Commands.InvokeCauRunCommandnon-zero return code
Any help on this?

Installation error in Service mesh Linkerd in aks

I have followed the getting started instructions here: https://linkerd.io/2/getting-started/ for installing linkerd but i am not able to install cli of linkerd.
Please see the command below: curl -sL https://run.linkerd.io/install | sh
Please see the error below:
Invoke-WebRequest : A positional parameter cannot be found that accepts argument 'https://run.linkerd.io/install'.
At line:1 char:1
+ curl --sL https://run.linkerd.io/install | sh
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
I had the same issue as you. The way I resolved it is as follows:
1) Install WSL for Windows 10: https://learn.microsoft.com/en-us/windows/wsl/install-win10.
2) Install Ubuntu from the Windows store: https://www.microsoft.com/en-gb/p/ubuntu/9nblggh4msv6
Then launch the Ubuntu shell and follow the instructions again. Please note this is not a virtual machine - just a shell.

Curl command with delete option throws an exception

I have been working on Elastic search for a while and I have scenario to delete some indices in the elasticsearch.
As instructed in the ELK user guide, am trying to delete the indices using the CURL command in PowerShell on Windows Server 2012 R2
The command is given below
curl -X DELETE 'http://localhost:9200/logstash-2016.12.19/'
But when I give this command to delete in PowerShell, it throws the below error:
Invoke-WebRequest : A parameter cannot be found that matches parameter name 'X'.
At line:1 char:6
+ curl -X DELETE 'http://10.242.244.170:9200/logstash-2016.12.19/'
+ ~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Can anyone help me solve this issue?
Curl is an alias for the Invoke-WebRequest cmdlet. It has no -X parameter but a -Method:
Invoke-WebRequest -Method Delete -Uri 'http://localhost:9200/logstash-2016.12.19/'

Running curl via powershell - how to construct arguments?

I'm trying to run curl to upload a file in my script, using batch was painful because I need to do string manipulation etc so I turned to powershell.
However I can't seem to get powershell to execute Curl:
$hash = "test"
$fileToUpload = "hello world.txt"
$user = "user"
$password = "passy"
curl --ftp-create-dirs -T $fileToUpload -u ${user}:${pass} ftp://example.com/$hash/$fileToUpload
This results in:
Invoke-WebRequest : Parameter cannot be processed because the parameter name 'T' is ambiguous. Possible matches include:
-TimeoutSec -TransferEncoding.
At line:5 char:24
+ curl --ftp-create-dirs -T $fileToUpload -u ${user}:${pass} ftp://example.com/$ha ...
+ ~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameter,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Curl.exe is in my PATH.
In PowerShell curl is a built in alias to Invoke-WebRequest cmdlet. And aliases have priority in command resolution. To solve your problem you have more specifically, use curl.exe instead of curl, so command not resolved to alias. Or you can remove alias Remove-Item alias:curl, but as it is build in alias you have to put this command in your profile, or invoke it in every session.
If you are not sure how PowerShell resolve your command, then you can use Get-Command cmdlet:
Get-Command curl
Get-Command curl.exe