Skip to content

Instantly share code, notes, and snippets.

@JeremyVV
Last active June 19, 2019 22:47
Show Gist options
  • Select an option

  • Save JeremyVV/fa19b03fa7fc5b89d5e480fad5d669f3 to your computer and use it in GitHub Desktop.

Select an option

Save JeremyVV/fa19b03fa7fc5b89d5e480fad5d669f3 to your computer and use it in GitHub Desktop.
[Download Windows Kubectl.exe] Gets the latest version of Kubectl.exe #kubernetes
<#PSScriptInfo
.VERSION 1.0
.GUID a4c35827-6014-4451-b78a-d57a0706cc5a
.AUTHOR Jeremy Van Veelen
.COMPANYNAME
.COPYRIGHT
.TAGS
.LICENSEURI
.PROJECTURI
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
#>
<#
.DESCRIPTION
This script is used during unattended installs or to download kubectl on windows
#>
param(
$Downloadlocation = $env:TEMP
)
if (!(Test-Path $Downloadlocation)) {
New-Item -ItemType Directory $Downloadlocation -ErrorAction SilentlyContinue | out-null
}
$version = Invoke-WebRequest -URI "https://storage.googleapis.com/kubernetes-release/release/stable.txt" | Where-Object { $_ -like 'v*' }
$version = $version[0] -replace "`t|`n|`r", ""
$downloadlink = "https://storage.googleapis.com/kubernetes-release/release/{0}/bin/windows/amd64/kubectl.exe" -f $version
Write-Host -ForegroundColor White "==>starting Download from $downloadlink using Bitstransfer"
Start-BitsTransfer $downloadlink -DisplayName "Getting KubeCTL from $downloadlink" -Destination $Downloadlocation
$Downloadfile = Join-Path $Downloadlocation "kubectl.exe"
Unblock-File $Downloadfile
Write-Host -ForegroundColor White "==>starting '$Downloadfile version'"
$Kube_Local = New-Item -ItemType directory "$($HOME)/.kube" -force
Write-Host
Write-Host -ForegroundColor Magenta "You can now start kubectl from $Downloadfile.
Copy your remote kubernetes cluster information to $($Kube_Local.fullname)/config
"
Write-Host "Vist https://www.assistanz.com/installing-minikube-on-windows-10-home-edition-using-virtualbox/ and https://medium.com/@wisegain/minikube-cheat-sheet-a273385e66c9 for next steps"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment