hello world

Quick 'Hello World' HTTP deployment for testing K3s and Traefik

Recently I needed to test the full HTTP stack between a Kubernetes cluster's member nodes and an external Internet routing setup, and so I wanted to quickly install K3s (which includes Traefik by default, and load balances through ports 80 and 443 on all nodes), then get a quick 'hello world' web page up, so I could see if the traffic was routing properly all the way from the external host through to a running container exposed via Traefik Ingress.

Here's how I set up a basic 'Hello World' web page on my K3s cluster:

First, I created an HTML file to be stored as a ConfigMap. Create a file named index.html with the following contents:

<html>
<head>
  <title>Hello World!</title>
</head>
<body>Hello World!</body>
</html>

Create a ConfigMap with the HTML from the file you just created:

$ kubectl create configmap hello-world --from-file index.html

Save the following to Kubernetes resource definitions into a file named hello-world.yml: