k8 by examples
  • k8
  • k8-byexamples-monorepo
  • AWS to GCP Proxy
  • Ingress + TLS Termination
  • Docker
  • HAproxy
  • Troubleshooting
  • Windows
  • Commands
  • Kubernetes Specs
    • Namespaces
    • Deployments
    • InitContainers
    • Ingress
    • Services
    • Storage
      • PersistentVolumeClaims
      • StorageClass
  • Tools
    • kubectl
      • Credentials
    • Port Scanning
  • Resources
    • Curated Resources List
    • Community
    • Contact Me
    • Ingress Controller + LetsEncrypt
  • K8-BYEXAMPLES
    • IngressController+LetsEncrypt
Powered by GitBook
On this page
  • Preparation
  • Install Docker
  • Copy ~/.kube/config from master
  • Download kubectl.exe
  • Add to PATH
  • Creating the "pause" image
  • Other
  • Install Chocolatey
  • Install kubectl.exe with Chocolatey

Windows

Preparation

Install Docker

prepare.ps1
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name Docker -ProviderName DockerMsftProvider
Restart-Computer -Force

Copy ~/.kube/config from master

Copy the ~/.kube/config from a master node and place it on the windows node under C:\k\config

Download kubectl.exe

get_kubectl.ps1
Install-Script -Name install-kubectl -Scope CurrentUser -Force
install-kubectl.ps1 -DownloadLocation C:\k
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
wget https://github.com/Microsoft/SDN/archive/master.zip -o master.zip
Expand-Archive master.zip -DestinationPath master
mkdir C:/k/
mv master/SDN-master/Kubernetes/windows/* C:/k/
rm -recurse -force master,master.zip

Add to PATH

$env:Path += ";C:\k"
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\k", [EnvironmentVariableTarget]::Machine)

$env:KUBECONFIG="C:\k\config"
[Environment]::SetEnvironmentVariable("KUBECONFIG", "C:\k\config", [EnvironmentVariableTarget]::User)

Creating the "pause" image

Now that docker is installed, you need to prepare a "pause" image that's used by Kubernetes to prepare the infrastructure pods.

docker pull microsoft/windowsservercore:1709
docker tag microsoft/windowsservercore:1709 microsoft/windowsservercore:latest
cd C:/k/
docker build -t kubeletwin/pause .

Other

Install Chocolatey

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Install kubectl.exe with Chocolatey

choco install kubernetes-cli

PreviousTroubleshootingNextCommands

Last updated 7 years ago