It's nice to be able to run kubectl remotely against a kubernetes cluster. Then, you don't have to ssh into the servers to run commands. (Also, you won't need to run kubectl from a Linux VM, which is what other people suggest.) You'll probably need commands like mkdir (provided through cygwin or a standard git installation with cygwin binaries included). But you might also be able to use the pre-built binary without these tools. (I'm not sure, really)
I've built a binary for you. It's commited into this repository. It's called kubectl-1.1.3.exe. You can download it and put it somewhere in your PATH. (I suggest that you rename it to kubectl.exe)
- cd C:\users\yourusername (Or wherever your %HOME% directory is)
- mkdir .kube
- cd .kube
- touch config
- Edit the config file with your editor of choice - notepad for example.
It could for example look like this:
apiVersion: v1
clusters:
- cluster:
server: https://123.456.789.123:9999
certificate-authority-data: yoursertificate
name: your-k8s-cluster-name
contexts:
- context:
cluster: your-k8s-cluster-name
namespace: default
user: admin
name: default-context
current-context: default-context
kind: Config
preferences: {}
users:
- name: admin
user:
token: your-login-token
You can also try to build it yourself:
- Set up a Go environment.
- Set your GOPATH environment variable. For these instructions we will use C:\gopath but %USERPROFILE%\go is more common.
- Add %GOPATH\bin to your PATH environment variable (exes like godep will be placed here and kubectl by the end of the install process)
- Make a directory to clone kubernetes:
mkdir C:\gopath\src\k8s.io
thencd C:\gopath\src\k8s.io
- View release tags and choose the release you wish to build (like v1.5.0)
- Checkout kubernetes using the release tag you choose -- we're using v1.5.0 in this example:
git clone --depth 1 https://github.com/kubernetes/kubernetes v1.5.0
- Install Godep (for dependency management) and mercurial (for fetching some dependencies)
- Fetch GO dependencies:
cd C:\gopath\src\k82.io\kubernetes\
thengodep restore
(If some dependencies fail, it might work anyways. Note this may take awhile - up to 10 min) - Build kubectl
cd C:\gopath\src\k8s.io\kubernetes\cmd\kubectl
thengo install .
(Note this may take awhile - up to 10 min) - The kubectl binary should now be at C:\gopath\bin\kubectl.exe