Installing kubectl

To configure and manage your cluster, you will probably use the kubectl command. You can use RESTful calls or the Go language, as well.

Enterprise Linux distributions have the various Kubernetes utilities and other files available in their repositories. For example, on RHEL/CentOS, you would find kubectl in the kubernetes-client package. On OpenShift they use a command very similar to kubectl called oc.

You can (if needed) download the code from GitHub, and go through the usual steps to compile and install kubectl.

This command line will use $HOME/.kube/config as a configuration file. This contains all the Kubernetes endpoints that you might use. If you examine it, you will see cluster definitions (i.e. IP endpoints), credentials, and contexts.

A context is a combination of a cluster and user credentials. You can pass these parameters on the command line, or switch the shell between contexts with a command, as in:

$ kubectl config use-context foobar

This is handy when going from a local environment to a cluster in the cloud, or from one cluster to another, such as from development to production.

Last updated