Use Kind and K9s to Learn Kubernetes Locally (on Ubuntu)

For the full instruction from the source, see

I documented my steps of setting up my new ubuntu laptop for Machine Learning and this step is one of the step of many. This blog assumes that you have some knowledge about kubernetes but is not required.


  • kind is a tool for running local Kubernetes clusters using Docker container β€œnodes”.
    kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI.
  • kubectl is a commandline tool to interact with your kubernetes cluster
  • K9s is a terminal based UI to interact with your Kubernetes clusters. 


Install Kind

 $ [ $(uname -m) = x86_64 ] && curl -Lo ./kind
$ chmod +x ./kind
$ sudo mv ./kind /usr/local/bin/kind

Install k9s

For detailed instruction, use and for linux-based instruction

On my ubuntu, I had to install home brew first

$ /bin/bash -c "$(curl -fsSL"

Then set brew to path and also install dependencies

$   (echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/jess/.bashrc
$  eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

Install dependencies

$ sudo apt-get install build-essential
$ brew install gcc

Finally install k9s

$  brew install derailed/k9s/k9s

Create a Sample Cluster and a Simple Echo Server

Then create a cluster locally (and if all is well, you should see creation progress similar to the following)

$ kind create cluster

Creating cluster "kind" ...
 βœ“ Ensuring node image (kindest/node:v1.29.2) πŸ–Ό 
 βœ“ Preparing nodes πŸ“¦  
 βœ“ Writing configuration πŸ“œ 
 βœ“ Starting control-plane πŸ•ΉοΈ 
 βœ“ Installing CNI πŸ”Œ 
 βœ“ Installing StorageClass πŸ’Ύ 
Set kubectl context to "kind-kind"
You can now use your cluster with:

kubectl cluster-info --context kind-kind

Have a nice day! πŸ‘‹

To view the cluster

Set the context

$ kubectl config get-contexts
           *         kind-kind     kind-kind      kind-kind   

Switch to that context (in case you are on a diff context)

# kubectl use-context kind-kind

Then check cluster status

$ kubectl get --raw='/readyz?verbose'

List pods

$kubectl get pods

Ahh, it’s empty and it’s no fun to have an empty cluster! Let’s create a pod.

We will just use a sample echo server pod from a publicly available docker image. Create a file called echo-server-pod.yaml:

apiVersion: v1
kind: Pod
  name: echo-server
    app: echo-server
  - name: echo-server
    image: ealen/echo-server
    - containerPort: 80

Then create the pod using kubectl apply

$ kubectl apply -f echo-server-pod.yaml 

Check pods

$ kubectl get pods

Then “port-forward” the remote-port (the port that the echo-server port binds to internally in kubernetes cluster) to the local-port (to your host environment)

# kubectl port-forward pod/echo-server <local-port>:<remote-port>  
$ kubectl port-forward pod/echo-server 8080:80 the 

Use K9S

When you have a complex k8s cluster, k9s would be an amazing tool to manage and troubleshoot, in additional to the kubectl cli interface.


To delete

$ kind delete cluster


No comments yet. Why don’t you start the discussion?

Leave a Reply