Testing our Kubernetes Cluster Print

Welcome to the second post in our Pi-IoT series.

Technology

In our previous post, we created a kubernetes cluster using raspberry pi’s. Lets test that cluster now

Deploying a Test Service


Log into the master node and deploy

kubectl starts a set of pods called hypriot from the hypriot/rpi-busybox-httpd image. Next, lets expose the pods in a service

The status can be checked like:

The output should look something like:

k8s-endpoints

You can curl the service to verify it is running

k8s-curl-service

Access the Service from Outside the Cluster


Lets display a sample Ingress Controller to manage incoming requests to our service. We will use Traefik as the load balancer. Lets setup the RBAC roles and deploy an example

Label the node you want to be the load balancer for the traefik ingress controller

NOTE: If you want to use the master node for the load balancer, you will need to remove the “NoSchedule” taint like:

otherwise just

Finally, create an Ingress object that makes Traefik load balance on port 80 with the hypriot service:

Once all pods are in a Running state:

Open the load balancers node in a browser and you will see the web page:

k8s-exposed-service