Kubernetes Administration Techniques

This blog entry is intended as a guide to some of the Kubernetes Administration features. It is not exhaustive list but instead is intended to serve as an introduction to some of these commands and hopefully provide enough information to learn about more advanced features.

Kubernetes Administration Techniques

Following on from my recent blog entry which provided an Introduction into Kubernetes this post outlines some of the basic concepts and techniques which can be used to administer and maintain your Kubernetes pods and services.

Minikube Dashboard

You can get a simple Dashboard for your Minikube instance in your browser by running the following command:

minikube dashboard

From within your browser you should be able to inspect and maintain cluster concepts such as pods, services, namespaces, volumes, roles etc … as well as workloads, storage, discovery and load balancing.


In order to monitor Pods you need to know how many should be running at any given time. This is achieved through the concept of a replicaset. It is also the responsibility of the replicaset to create the pod instances for you rather than having to do this manually.

apiVersion: extensions/v1beta1
kind: ReplicaSets
  name: nginx
  replicas: 3
      foo: bar
      name: nginx
        foo: bar
      - name: nginx
        image: nginx

The selector here is used to help count the number of a particular set of Pods (e.g. 3) and we understand that these are associated with the nginx service according to the template specification.

There are different types of replicaset api’s supported. The api version extensions/v1beta1 here is the advanced beta version of Kubernetes which supports the concept of replica sets.

kubectl create -f rs.yaml     # Create a replicaset from the above yaml configuration
kubectl get replicaset        # List all replicasets
kubectl get pods              # List all pods - should now contain our 3 instances from the replicaset

With the replicaset in place if any of the pods should stop for whatever reason Kubernetes should create another pod instance as required.

If you need to manually adjust this replicaset to increase or decrease the number of running pod instances you can run:

kubectl scale rs nginx --replicas 5
kubectl get endpoints

Kubernetes API

If you want to investigate the Kubernetes API from the command line you can run the following:

kubectl proxy

In another terminal you can then call the resulting endpoint locally with curl to get the list of Kubernetes API endpoints:

curl localhost:8001

Exmaple output:

  "paths": [


If you need to run commands inside your cluster instance you can use busybox:

kubectl run busy -ti --image busybox -- /bin/sh

This will open a shell where for instance you can run commands like nslookup against your service names. However most of this information is exposed via the usual kubectl commands (e.g. kubectl get svc).

A list of the busybox supported commands is currently available on wikipedia at the following link:


Namespaces can be created and assigned to a number of pods. This allows for greater flexibility and maintenance of your pods.

kubectl get namespaces              # Get all namespaces
kubectl get pods --all-namespaces   # Get all pods with their namespaces
kubectl get pods -n <NAMESPACE>     # Get all pods with the matching namespace

There many ways that you can use this feature. For instance you can assign namespaces per individual or you could assign a namespace for a particular environment such as dev, test or prod. Another option is to extend the concept of namespaces for a particular environment so for example in dev have a namespace for each individual team, in prod this might be at an application level due to the number of pods required for a live environment.

You can also use namespaces to determine quotas out-of-the-box with namespaces which you will see in the next section.

Resource Quotas

kubectl create resourcequotas test --hard=pods=1 -n <NAMESPACE>
kubectl get resourcequotas -n <NAMESPACE>

Based on the above resource quota Kubernetes will complain when you next try to create a pod instance attached to the given namespace. The quota here is limited to 1 but the number can be whatever you require. You can even come back and edit the resourcequota if you need to:

kubectl edit resourcequota -n <NAMESPACE>

This will open your favourite editor and allow you to modify the yaml file configuration for your resource quota.

If you want to you can even use these quotas to determine network policies but that would require additional add-ons.


Hopefully you’ve learnt a few new things about how Kubernetes administration. There are a lot of other topics that I haven’t covered some of which may be redundant if you already know them from other orchestration tools or from container tools like Docker.