While Kubernetes is designed to run across large clusters, it can be useful to have Kubernetes available on a single machine. This guide walks a deployer through this process using Vagrant and CoreOS. After completing this guide, a deployer will be able to interact with the Kubernetes API from their workstation using the kubectl CLI tool.
Navigate to the Vagrant downloads page and grab the appropriate package for your system. Install the downloaded software before continuing.
The primary CLI tool used to interact with the Kubernetes API is called kubectl
.
This tool is not yet available through the typical means of software distribution, so it is suggested that you download the binary directly from the Kubernetes release artifact site:
First, download the binary using a command-line tool such as wget
or curl
from https://storage.googleapis.com/kubernetes-release/release/v1.0.6/bin/${ARCH}/amd64/kubectl
.
Set the ARCH environment variable to "linux" or "darwin" based on your workstation operating system:
ARCH=linux; wget https://storage.googleapis.com/kubernetes-release/release/v1.0.6/bin/$ARCH/amd64/kubectl
After downloading the binary, ensure it is executable and move it into your PATH:
$ chmod +x kubectl
$ mv kubectl /usr/local/bin/kubectl
The following commands will clone a repository that contains a "Vagrantfile", which describes the set of virtual machines that will run Kubernetes on top of CoreOS.
$ git clone https://github.com/coreos/coreos-kubernetes.git
$ cd coreos-kubernetes/single-node/
Simply run vagrant up
and wait for the command to succeed.
Once Vagrant is finished booting and provisioning your machine, your cluster is good to go.
Once in the coreos-kubernetes/single-node/
directory, configure your local Kubernetes client using the following commands:
$ kubectl config set-cluster vagrant --server=https://172.17.4.99:443 --certificate-authority=${PWD}/ssl/ca.pem
$ kubectl config set-credentials vagrant-admin --certificate-authority=${PWD}/ssl/ca.pem --client-key=${PWD}/ssl/admin-key.pem --client-certificate=${PWD}/ssl/admin.pem
$ kubectl config set-context vagrant --cluster=vagrant --user=vagrant-admin
$ kubectl config use-context vagrant
Check that your client is configured properly by using kubectl
to inspect your cluster:
$ kubectl get nodes
NAME LABELS STATUS
172.17.4.99 kubernetes.io/hostname=172.17.4.99 Ready