Kubernetes 101: A How To Tutorial

Posted on by David Singer | Updated:
Reading Time: 3 minutes

What is Kubernetes?

The name Kubernetes has its origins from the original Greek term for helmsman or pilot. Kubernetes, or ‘k8s’ (pronounced “Kate’s”) as it’s sometimes referred to, is an open-source software tool that was originally created by Google and is now being maintained by the Cloud Native Computing Foundation. Kubernetes is used for arranging and coordinating containers that an application needs to run into easy to handle groups.

In order to manage your Kubernetes server cluster effectively, we recommend using kubectl as the command-line tool of choice. Basically, kubectl communicates with the master node (or server) which in turn submits those commands to the worker nodes to manage the cluster.

The Kubernetes cluster consists of two basic types of resources;

  • Master server - a master server organizes the cluster
  • Node server - Nodes are the workers that contain and run the applications

Each node contains a Kubelet, which is the agent for managing the node and communicating with the master. You can use kubectl to deploy, explore, review and remove Kubernetes objects (like nodes, images or containers).

Next, let’s look at setting up kubectl.

The Master communicates with containers through the worker node.
This tutorial assumes you have a Kubernetes cluster already setup and running.

In order to set up kubectl, we will need the following:


  1. A working internet connection
  2. The cURL or wget utilities installed
  3. Basic knowledge of the Linux command line

Installing kubectl

On an Ubuntu 16.04 LTS server, here are the commands to use if logged in as root to install kubectl:

root@host:~# apt-get update && sudo apt-get install -y apt-transport-https 

root@host:~# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - touch /etc/apt/sources.list.d/kubernetes.list

root@host:~# echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list  

root@host:~# apt-get update 

root@host:~# apt-get install -y kubectl 

root@host:~# kubectl version --client

Basic Kubectl Commands for Kubernetes

Now that we have kubectl up and running, let’s review a few of the basic commands available. Here are the five most basic commands we will be reviewing along with their fundamental definition:

  • kubectl create - the create command constructs a resource from a configuration file or stdin (or standard input). A resource is defined as "something that can be “requested by”, “allocated to”, “or consumed by” a pod or container."
  • kubectl get - the get command displays a table of the most relevant information about one or multiple relevant resources.
  • kubectl run -  the run command will kick off one or more instances of a container in the cluster.
  • kubectl expose - the expose command will start to load balance inbound traffic across your running instances. This command can also create a High Availability proxy for the client to access the running containers from outside the server cluster.
  • kubectl delete - the delete command removes defined resources by
    • filenames
    • stdin
    • resources and names
    • resources and label selector

Kubectl App Management

  • kubectl edit - Alters the characteristics of a resource on a server using the default editor.
  • kubectl apply - Applies a change to a resource from a file or stdin.
  • kubectl label - Adds or updates a specific attribute to specifically identify an object

Working with Apps Using Kubectl

  • kubectl exec - Runs a command on a container in a pod
  • kubectl logs - Prints a container log
  • kubectl describe - Displays the status or state of the resources.

Kubectl Cluster Management

  • kubectl cluster-info - Displays information about the master and services in the cluster.
  • kubectl drain - removes pods in preparation for maintenance
  • kubectl certificate - Approves a CSR or certificate signing request

Kubectl Settings and Usage

  • kubectl api-resources (e.g. Pods and Services) - Lists all the supported resources and their shortnames, API grouping, if namespaced, and Kind
  • kubectl config -  Changes or alters kubeconfig files
  • kubectl version - Displays the Kubernetes version

These are just some of the basic command examples that are available for use in setting up and maintaining your Kubernetes environment.

The Most Helpful Humans In Hosting™

We pride ourselves on being The Most Helpful Humans In Hosting™! Our support staff is always available to assist existing customers with any Dedicated Server, Cloud Dedicated Server, or VPS Hosting issues 24 hours a day, 7 days a week, 365 days a year. If you need one of these options for your next project, contact our sales team today.

Avatar for David Singer

About the Author: David Singer

I am a g33k, Linux blogger, developer, student, and former Tech Writer for Liquidweb.com. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Latest Articles

How to use kill commands in Linux

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change cPanel password from WebHost Manager (WHM)

Read Article

Change the root password in WebHost Manager (WHM)

Read Article