Friday, May 15, 2020

Kubernetes 101 - Part3 - Install kubectl on Windows

This article shows how to install kubectl on a Windows machine and connect to a remote Kubernetes cluster.

Open PowerShell as administrator and run the following:
Install-Script -Name install-kubectl -Scope CurrentUser -Force


This will download the installation files to Windows PowerShell script folder of the current user. In my case it is: C:\Users\vineetha\Documents\WindowsPowerShell\Scripts


Now browse to the above location in Powershell and execute the install-kubectl.ps1 file.
install-kubectl.ps1 [-DownloadLocation <path>]

Note: If you do not specify a DownloadLocationkubectl will be installed in the user's temp directory.


In this case, I have not specified the path. So it is installed in the temp directory of the current user.


You can see .kube directory is already created on this Windows machine.


Copy the kube config file from the K8s master to the .kube directory using WinSCP.

 

Now open PowerShell and browse to the directory where kubectl.exe is installed (in this case the temp directory) and connect to the K8s cluster.

No comments:

Post a Comment