Code Monkey home page Code Monkey logo

kubectl-windows's Introduction

Running kubectl on Windows

Why??

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)

Download a pre-built Windows binary

See releases, download kubectl.exe, and put kubectl.exe somewhere in your PATH.

Configuring kubectl to use a remote kubernetes cluster

  1. cd C:\users\yourusername (Or wherever your %HOME% directory is)
  2. mkdir .kube
  3. cd .kube
  4. touch config
  5. 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

Do It Yourself (aka. building from source)

You can also try to build it yourself:

  1. Set up a Go environment.
  2. Set your GOPATH environment variable. For these instructions we will use C:\gopath but %USERPROFILE%\go is more common.
  3. Add %GOPATH\bin to your PATH environment variable (exes like godep will be placed here and kubectl by the end of the install process)
  4. Make a directory to clone kubernetes: mkdir C:\gopath\src\k8s.io then cd C:\gopath\src\k8s.io
  5. View release tags and choose the release you wish to build (like v1.5.0)
  6. 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
  7. Install Godep (for dependency management) and mercurial (for fetching some dependencies)
  8. Fetch GO dependencies: cd C:\gopath\src\k82.io\kubernetes\ then godep restore (If some dependencies fail, it might work anyways. Note this may take awhile - up to 10 min)
  9. Build kubectl cd C:\gopath\src\k8s.io\kubernetes\cmd\kubectl then go install . (Note this may take awhile - up to 10 min)
  10. The kubectl binary should now be at C:\gopath\bin\kubectl.exe

kubectl-windows's People

Contributors

eirslett avatar samuelms1 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.