website/v1.1/docs/user-guide/prereqs.md

2.9 KiB
Raw Blame History

layout title
docwithnav Kubernetes User Guide: Managing Applications: Prerequisites

Kubernetes User Guide: Managing Applications: Prerequisites

To deploy and manage applications on Kubernetes, youll use the Kubernetes command-line tool, kubectl. It lets you inspect your cluster resources, create, delete, and update components, and much more. You will use it to look at your new cluster and bring up example apps.

Installing kubectl

If you downloaded a pre-compiled release, kubectl should be under platforms/<os>/<arch> from the tar bundle.

If you built from source, kubectl should be either under _output/local/bin/<os>/<arch> or _output/dockerized/bin/<os>/<arch>.

The kubectl binary doesn't have to be installed to be executable, but the rest of the walkthrough will assume that it's in your PATH.

The simplest way to install is to copy or move kubectl into a dir already in PATH (e.g. /usr/local/bin). For example:

{% highlight console %} {% raw %}

OS X

$ sudo cp kubernetes/platforms/darwin/amd64/kubectl /usr/local/bin/kubectl

Linux

$ sudo cp kubernetes/platforms/linux/amd64/kubectl /usr/local/bin/kubectl {% endraw %} {% endhighlight %}

You also need to ensure it's executable:

{% highlight console %} {% raw %} $ sudo chmod +x /usr/local/bin/kubectl {% endraw %} {% endhighlight %}

If you prefer not to copy kubectl, you need to ensure the tool is in your path:

{% highlight bash %} {% raw %}

OS X

export PATH=<path/to/kubernetes-directory>/platforms/darwin/amd64:$PATH

Linux

export PATH=<path/to/kubernetes-directory>/platforms/linux/amd64:$PATH {% endraw %} {% endhighlight %}

Configuring kubectl

In order for kubectl to find and access the Kubernetes cluster, it needs a kubeconfig file, which is created automatically when creating a cluster using kube-up.sh (see the getting started guides for more about creating clusters). If you need access to a cluster you didnt create, see the Sharing Cluster Access document. By default, kubectl configuration lives at ~/.kube/config.

Making sure you're ready

Check that kubectl is properly configured by getting the cluster state:

{% highlight console %} {% raw %} $ kubectl cluster-info {% endraw %} {% endhighlight %}

If you see a url response, you are ready to go.

What's next?

Learn how to launch and expose your application.

Analytics