Last active
March 17, 2021 23:24
-
-
Save luthermonson/a6d006d3a407174802d403bc1c4939a2 to your computer and use it in GitHub Desktop.
containerd install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New-Item -ItemType Directory -Path "$Env:ProgramFiles\containerd" -Force > $null | |
curl.exe -L https://github.com/luthermonson/containerd/releases/download/win-bins/containerd-shim-runhcs-v1.exe -o "$Env:ProgramFiles\containerd\containerd-shim-runhcs-v1.exe" | |
curl.exe -L https://github.com/luthermonson/containerd/releases/download/win-bins/containerd.exe -o "$Env:ProgramFiles\containerd\containerd.exe" | |
curl.exe -L https://github.com/luthermonson/containerd/releases/download/win-bins/ctr.exe -o "$Env:ProgramFiles\containerd\ctr.exe" | |
# Set containerd config.toml | |
$ProcessInfo = New-Object System.Diagnostics.ProcessStartInfo | |
$ProcessInfo.FileName = "$Env:ProgramFiles\containerd\containerd.exe" | |
$ProcessInfo.RedirectStandardError = $true | |
$ProcessInfo.RedirectStandardOutput = $true | |
$ProcessInfo.UseShellExecute = $false | |
$ProcessInfo.Arguments = "config default" | |
$Process = New-Object System.Diagnostics.Process | |
$Process.StartInfo = $ProcessInfo | |
$Process.Start() | Out-Null | |
$Process.WaitForExit() | |
$config = $Process.StandardOutput.ReadToEnd() | |
$config = $config -replace "bin_dir = (.)*$", "bin_dir = `"c:/opt/cni/bin`"" | |
$config = $config -replace "conf_dir = (.)*$", "conf_dir = `"c:/etc/cni/net.d`"" | |
$config = $config -replace "sandbox_image = `"mcr.microsoft.com/oss/kubernetes/pause:1.4.0`"", "sandbox_image = `"docker.io/rancher/kubelet-pause:v0.1.6`"" | |
Set-Content -Path $Env:ProgramFiles\containerd\config.toml -Value $config -Force | |
Add-MpPreference -ExclusionProcess "$Env:ProgramFiles\containerd\containerd.exe" | |
Start-Process -FilePath "$Env:ProgramFiles\containerd\containerd.exe" -ArgumentList "--register-service" -NoNewWindow | |
Sleep 2 | |
Set-Service -Name containerd -StartupType Automatic | |
Start-Service containerd | |
$path = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).path | |
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH -Value "$path;$Env:ProgramFiles\containerd" | |
$env:PATH = "$path;$Env:ProgramFiles\containerd" | |
$KubernetesVersion = "1.20.4" | |
$kubernetesPath = "C:\k" | |
New-Item -ItemType Directory -Path $kubernetesPath -Force > $null | |
Invoke-WebRequest -OutFile $kubernetesPath\kubelet.exe https://storage.googleapis.com/kubernetes-release/release/v$KubernetesVersion/bin/windows/amd64/kubelet.exe | |
Invoke-WebRequest -OutFile $kubernetesPath\kubectl.exe https://storage.googleapis.com/kubernetes-release/release/v$KubernetesVersion/bin/windows/amd64/kubectl.exe | |
Invoke-WebRequest -OutFile $kubernetesPath\kube-proxy.exe https://storage.googleapis.com/kubernetes-release/release/v$KubernetesVersion/bin/windows/amd64/kube-proxy.exe | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
one liner